mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Join with composite keys #5409
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 @dautushenka on GitHub (Feb 6, 2017).
Originally assigned to: @Ocramius on GitHub.
I have EAV pattern with 4 entities:
Item.php
Attribute.php
AttributeValue.php
ItemAttributeValue.php
As you can see entity "ItemAttributeValue" has composite foreign key "attributeValue", now I am trying to find some items with certain attribute values:
And I am getting following error:
A single-valued association path expression to an entity with a composite primary key is not supported. Explicitly name the components of the composite primary key in the query.
As result I'd like to get query like that:
I don't want to join "AttributeValue" at all.
Used versions:
Thank you for the answers in advance.
Link: http://stackoverflow.com/questions/42018313/doctrine-join-with-composite-keys
@Ocramius commented on GitHub (Feb 7, 2017):
What could probably be attempted is:
Another approach is to combine it with the
IDENTITY()function (can't remember if it works with composite PKs).Another approach is to just join the association (not a big issue, if your indexes are in place).
@Ocramius commented on GitHub (Feb 7, 2017):
Closing, since this is a question about a well known limitation (exception is there for a reason), and not an issue.