mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Cannot index-by related entity #6210
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 @crtl on GitHub (Mar 29, 2019).
Bug Report
Summary
When trying to index by a property that is a mapped relation the following error is thrown:
Current behavior
Exception is thrown
How to reproduce
Create the following mapping:
Expected behavior
The participants should be correctly mapped by their related users id or the schema validator should throw an error when validating the schema (schema is valid).
@andrews05 commented on GitHub (Nov 20, 2019):
Have you tried using the name of the join column, e.g. "user_id" instead of just "user"? This is working for me in v3.
@andrews05 commented on GitHub (Nov 20, 2019):
What I can't do is use INDEX BY in a query in the same manner.
SELECT p FROM Participant INDEX BY p.user_id: "Class Participant has no field or association named related_id"SELECT p FROM Participant INDEX BY p.user: "Invalid PathExpression. Must be a StateFieldPathExpression."@beberlei commented on GitHub (Feb 6, 2021):
Fixed and targeted for 2.9.0