mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
EntityRepository::findBy() no longer works with 'id' key #6866
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dsentker on GitHub (Oct 22, 2021).
Bug Report
Summary
Before ORM < 2.10.2, i was able to collect all entities by ID with the Doctrine\ORM\EntityRepository::findBy method:
This no longer works.
Current behavior
I initially thought that my array ($ids) was empty, but this was not the case.
How to reproduce
With given Version, try to obtain entities by id:
Expected behavior
The repository returns an array of Entities matching the ID provided in the findBy Method.
However, a workaround is to use a new query builder instance and use the clumsy DQL IN(...) command:Update1:
I found out that the findBy() method call is not responsible to reproduce this issue. I got the error described before with the the QueryBuilder too (but strangely, only in some cases).
I was able to omit the error when i do not pass an array of ids. When i convert the array to a string, everything works fine:
Update 2:
I tried passing a new ArrayCollection as stated in the documentation, but this will not work either:
Update 3:
Using the
Exprclass seems to solve the problem:@greg0ire commented on GitHub (Oct 23, 2021):
Possible next steps:
git bisect@sir-kain commented on GitHub (Feb 5, 2022):
I wrote this following assertion and it fails even on
2.10.0. For commit011d3c21eb