From 2043935ed0ed5b00f7963299895f1bb9cd26e8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sun, 16 Jan 2022 21:38:24 +0100 Subject: [PATCH] initialize filter iterator by default --- src/Persistence/Array_.php | 2 -- src/Persistence/Array_/Action.php | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Persistence/Array_.php b/src/Persistence/Array_.php index 697fe8f073..32b8f9dbe5 100644 --- a/src/Persistence/Array_.php +++ b/src/Persistence/Array_.php @@ -214,7 +214,6 @@ public function tryLoad(Model $model, $id): ?array { if ($id === self::ID_LOAD_ONE || $id === self::ID_LOAD_ANY) { $action = $this->action($model, 'select'); - $action->generator->rewind(); // TODO needed for some reasons! $selectRow = $action->getRow(); if ($selectRow === null) { @@ -238,7 +237,6 @@ public function tryLoad(Model $model, $id): ?array $condition->key = $model->getField($model->id_field); $condition->setOwner($model->createEntity()); // TODO needed for typecasting to apply $action->filter($condition); - $action->generator->rewind(); // TODO needed for some reasons! $rowData = $action->getRow(); if ($rowData === null) { diff --git a/src/Persistence/Array_/Action.php b/src/Persistence/Array_/Action.php index 4b692458ab..d4af23c4b5 100644 --- a/src/Persistence/Array_/Action.php +++ b/src/Persistence/Array_/Action.php @@ -45,6 +45,7 @@ public function filter(Model\Scope\AbstractScope $condition) } else { $this->generator = new \CallbackFilterIterator($this->generator, $filterFx); } + $this->generator->rewind(); // initialize filter iterator, it is not rewound by default } return $this;