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..fb716ef5b2 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, not rewound by default } return $this;