- Added support for Ignore attribute in dataset export of EntityTrait
- Work done on JSONification of entity
This commit is contained in:
1 parent
7f8780d328
commit
3a80fee9c3
5 files changed
+60
-22
No files matched your search
@@ -326,6 +326,17 @@ class EntityCollection extends \ArrayObject implements \JsonSerializable {
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function toJsonArray(bool $includeRelations = false) : array {
|
||||
$list = [];
|
||||
|
||||
foreach($this as $entity) {
|
||||
$list[] = $entity instanceof \JsonSerializable ? $entity->jsonSerialize() : $entity->toArray($includeRelations);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
public function fromArray(array $datasets, ? string /*stringable*/ $entityClass = null) : self
|
||||
{
|
||||
foreach($datasets as $dataset) {
|
||||
@@ -360,7 +371,7 @@ class EntityCollection extends \ArrayObject implements \JsonSerializable {
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return $this->toArray(true);
|
||||
return $this->toJsonArray(true);
|
||||
}
|
||||
|
||||
public function append($value) : void
|
||||
|
||||
Reference in new issue
Block a user