From b347902c3cdb8bcbd041f3b2b40deb6fdf35aebb Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Sat, 9 Nov 2024 14:42:15 +0200 Subject: [PATCH] deprecation removal --- application/Espo/ORM/EntityCollection.php | 33 +++++++---------------- application/Espo/ORM/SthCollection.php | 31 +++++---------------- 2 files changed, 16 insertions(+), 48 deletions(-) diff --git a/application/Espo/ORM/EntityCollection.php b/application/Espo/ORM/EntityCollection.php index eb46a8fe99..5c2920700f 100644 --- a/application/Espo/ORM/EntityCollection.php +++ b/application/Espo/ORM/EntityCollection.php @@ -347,35 +347,20 @@ class EntityCollection implements Collection, Iterator, Countable, ArrayAccess, return false; } - /** - * @deprecated As of v6.0. Use `getValueMapList`. - * @todo Remove in v9.0. - * @return array>|stdClass[] - */ - public function toArray(bool $itemsAsObjects = false): array - { - $arr = []; - - foreach ($this as $entity) { - $item = $entity->getValueMap(); - - if (!$itemsAsObjects) { - $item = get_object_vars($item); - } - - $arr[] = $item; - } - - return $arr; - } - /** * {@inheritDoc} */ public function getValueMapList(): array { - /** @var stdClass[] */ - return $this->toArray(true); + $list = []; + + foreach ($this as $entity) { + $item = $entity->getValueMap(); + + $list[] = $item; + } + + return $list; } /** diff --git a/application/Espo/ORM/SthCollection.php b/application/Espo/ORM/SthCollection.php index 8119eabc62..2dc3e59b51 100644 --- a/application/Espo/ORM/SthCollection.php +++ b/application/Espo/ORM/SthCollection.php @@ -137,35 +137,18 @@ class SthCollection implements Collection, IteratorAggregate, Countable protected function prepareEntity(Entity $entity): void {} - /** - * @deprecated As of v6.0. Use `getValueMapList`. - * @todo Remove in v9.0. - * @return array>|stdClass[] - */ - public function toArray(bool $itemsAsObjects = false): array - { - $arr = []; - - foreach ($this as $entity) { - $item = $entity->getValueMap(); - - if (!$itemsAsObjects) { - $item = get_object_vars($item); - } - - $arr[] = $item; - } - - return $arr; - } - /** * {@inheritDoc} */ public function getValueMapList(): array { - /** @var stdClass[] */ - return $this->toArray(true); + $list = []; + + foreach ($this as $entity) { + $list[] = $entity->getValueMap();; + } + + return $list; } /**