You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#11194 seems to resolve this issue.
My original assumption was that it's caused by the alias being selected twice, but this proved wrong. It's more probably caused by something in the result itself (at least this seems to be the case for me and @winiarekk)
Summary
After upgrading to 2.16.0 a query that was selecting the same alias twice started throwing the following exception:
The given entity of type 'Baz' (Baz@31833) has no identity/no id values set. It cannot be added to the identity map.
Obviously the query shouldn't select the same alias twice, however this was working until 2.15.5.
I was able to identify the change that causes the different behavior as this one. If I add the 4 lines from 2.15.5 instead of the call to registerManaged it works but I noticed that the $idHash is an empty string in this case.
I also found this issue that seems related: #10889
Previous behavior
The Foo entity was hydrated successfully.
Current behavior
Doctrine\ORM\ORMInvalidArgumentException:
The given entity of type 'Baz' (Baz@31833) has no identity/no id values set. It cannot be added to the identity map.
in doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php -> getIdHashByEntity
How to reproduce
I tried to reproduce this in a test case, but with no success. Anyway, here's a simplified version of the code that causes the error:
I have the same issue after upgrading doctrine, however in my case there is definitely no duplicated select of the same alias. What's even more interesting, the hydration for the query works good if I change one parameter in it, so it seems to be somehow related to the data.
I was trying to figure out what's wrong, so I inspected the raw results of SQL between non-working and working queries. The only difference, I was able to observe, is that the failing query has only one row in the result, when the successful ones return at least few of them, but no idea if this is related.
#11194 solves the issue for me too.
I also tested two cases without the fix - the first one returns 4 rows (for the same Foo) and it works, the other returns 39 rows (again, for the same Foo) and it fails. So this probably has nothing to do with the multiple selects.
BC Break Report
EDIT
#11194 seems to resolve this issue.
My original assumption was that it's caused by the alias being selected twice, but this proved wrong. It's more probably caused by something in the result itself (at least this seems to be the case for me and @winiarekk)
Summary
After upgrading to 2.16.0 a query that was selecting the same alias twice started throwing the following exception:
Obviously the query shouldn't select the same alias twice, however this was working until 2.15.5.
I was able to identify the change that causes the different behavior as this one. If I add the 4 lines from 2.15.5 instead of the call to
registerManaged
it works but I noticed that the$idHash
is an empty string in this case.I also found this issue that seems related: #10889
Previous behavior
The Foo entity was hydrated successfully.
Current behavior
Doctrine\ORM\ORMInvalidArgumentException:
in doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php -> getIdHashByEntity
How to reproduce
I tried to reproduce this in a test case, but with no success. Anyway, here's a simplified version of the code that causes the error:
The text was updated successfully, but these errors were encountered: