Files
ulmus/src/Entity/ArrayCollection.php
T
mcndave 13b7cf06f1 - ArrayOf errors now catched in EntityTrait (event soon to be attached to it)
- Fixed some non-nullable defaulted to null vars in functions
- Added a new diff method for entities which skips nullable values if they are not defined.
2026-07-13 12:33:40 +00:00

27 lines
565 B
PHP

<?php
namespace Ulmus\Entity;
use Ulmus\EntityCollection;
class ArrayCollection extends EntityCollection implements JsonUnserializable
{
public function jsonUnserialize(array $json): void
{
$this->fromArray($json);
}
public function jsonSerialize(): mixed
{
return $this->getArrayCopy();
}
public function fromArray(array $datasets, ? string /*stringable*/ $entityClass = null) : self
{
foreach($datasets as $dataset) {
\ArrayObject::append($dataset);
}
return $this;
}
}