From bb6d7f9f3ffbe1e22ac7074eb477d5abdeb9b77a Mon Sep 17 00:00:00 2001 From: Ioannis Papikas Date: Sat, 17 Mar 2018 15:34:41 +0200 Subject: [PATCH] Add $includeForeignObjects in ObjectCollection::toArray() parameters --- src/Propel/Runtime/Collection/ObjectCollection.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Propel/Runtime/Collection/ObjectCollection.php b/src/Propel/Runtime/Collection/ObjectCollection.php index 36eb0cfbfa..21018e9ccf 100644 --- a/src/Propel/Runtime/Collection/ObjectCollection.php +++ b/src/Propel/Runtime/Collection/ObjectCollection.php @@ -144,6 +144,7 @@ public function fromArray($arr) * TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to TRUE. * * * $bookCollection->toArray(); @@ -165,7 +166,7 @@ public function fromArray($arr) * * @return array */ - public function toArray($keyColumn = null, $usePrefix = false, $keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = []) + public function toArray($keyColumn = null, $usePrefix = false, $keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = [], $includeForeignObjects = true) { $ret = []; $keyGetterMethod = 'get' . $keyColumn; @@ -174,7 +175,7 @@ public function toArray($keyColumn = null, $usePrefix = false, $keyType = TableM foreach ($this->data as $key => $obj) { $key = null === $keyColumn ? $key : $obj->$keyGetterMethod(); $key = $usePrefix ? ($this->getModel() . '_' . $key) : $key; - $ret[$key] = $obj->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + $ret[$key] = $obj->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, $includeForeignObjects); } return $ret;