- 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.
27 lines
565 B
PHP
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;
|
|
}
|
|
} |