Skip to content

Commit 8e01059

Browse files
committed
Fixing fetchByIds method to bypass Doctrine problem with empty IN clauses.
1 parent 4bea1e9 commit 8e01059

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

app/model/repository/BaseRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ public function findOneBy(array $criteria)
8686
*/
8787
public function findByIds(array $ids): array
8888
{
89-
return $this->findBy(["id" => $ids]);
89+
// the bypass for empty array is needed to avoid SQL error (Doctrine issue)
90+
return empty($ids) ? [] : $this->findBy(["id" => $ids]);
9091
}
9192

9293
/**

0 commit comments

Comments
 (0)