Skip to content

Commit

Permalink
initialize filter iterator by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jan 16, 2022
1 parent b363b30 commit 2043935
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 0 additions & 2 deletions src/Persistence/Array_.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/Persistence/Array_/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2043935

Please sign in to comment.