diff --git a/src/EntityMapper.php b/src/EntityMapper.php index fb7960c..c7ba679 100644 --- a/src/EntityMapper.php +++ b/src/EntityMapper.php @@ -800,12 +800,11 @@ public function deleteWhere(mixed $conditions, int $options = 0): void } else { // If Entity has keys, use this keys to delete once per item. $delItems = (function () use ($metadata, $conditions) { - while ( - $item = $this->getORM() + $query = $this->getORM() ->from($metadata->getClassName()) - ->where($this->conditionsToWheres($conditions)) - ->get($metadata->getClassName()) - ) { + ->where($this->conditionsToWheres($conditions)); + + while ($item = $query->get($metadata->getClassName())) { yield $item; } })();