<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
*/
public function column($column, $index_key = null)
{
- return array_column($this->getArrayCopy(), $column, $index_key);
+ return array_column($this->getArrayCopy(true), $column, $index_key);
}
/**
{
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());
+ }
}