mirror of
https://github.com/friendica/friendica
synced 2025-04-28 02:30:16 +00:00
Fixups
This commit is contained in:
parent
7061e16b27
commit
f273c27e3b
7 changed files with 99 additions and 10 deletions
|
@ -87,7 +87,7 @@ class BaseCollection extends \ArrayIterator
|
|||
*/
|
||||
public function column($column, $index_key = null)
|
||||
{
|
||||
return array_column($this->getArrayCopy(), $column, $index_key);
|
||||
return array_column($this->getArrayCopy(true), $column, $index_key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,4 +124,21 @@ class BaseCollection extends \ArrayIterator
|
|||
{
|
||||
return new static(array_reverse($this->getArrayCopy()), $this->getTotalCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*
|
||||
* includes recursion for entity::toArray() function
|
||||
* @see BaseEntity::toArray()
|
||||
*/
|
||||
public function getArrayCopy(bool $recursive = false): array
|
||||
{
|
||||
if (!$recursive) {
|
||||
return parent::getArrayCopy();
|
||||
}
|
||||
|
||||
return array_map(function ($item) {
|
||||
return is_object($item) ? $item->toArray() : $item;
|
||||
}, parent::getArrayCopy());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue