mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1311: ResultSetMappingBuilder breaks on bidirectional association mapping #1645
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 @doctrinebot on GitHub (Aug 1, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user @asm89:
Breakage since DDC-1725. Will try to write some testcases.
@doctrinebot commented on GitHub (Aug 6, 2011):
Comment created by @beberlei:
What is DDC-1725? :)
@doctrinebot commented on GitHub (Aug 9, 2011):
Comment created by @asm89:
Ah, that had to be DDC-1275... I talked to mridgway about it and he acknowledged the issue, but -I'm not sure if it's a bug that it doesn't work anymore, or- it was undefined behaviour before (that accidently worked).
From the top if my head, it was something like this going wrong:
-- id
-- name
-- product_id
-- stock
-- country
-- product_id
-- sale_id
select * from products p
join product_stock_country psc ON p.id = psc.product_id AND country = 'en'
join product_sales ps ON p.id = ps.product_id
Map all the entities with and there will be an error that product_id is mapped multiple times (before the patch of mridgway it wasn't mapped at all). The query would work if product_id gets aliased both times and the renamed columns are given to the RSMB, but then the benefits of the RSMB would be a bit gone. That it worked before was undefined behaviour.
Aliasing all the appropriate columns for an entity is a lot of worked when there are a lot of entitites, while the point of the RSMB is that it should make it less work to create ResultSetMappings. Maybe it's an idea to also get the select * aliases for an entity from the RSMB? That way the aliases in an application will get updated as the metadata changes.
Edit: clarification + another conversation with mridgway.
@doctrinebot commented on GitHub (Aug 14, 2011):
Comment created by @beberlei:
Aliasing is the way to go here, it couldnt have worked "correctly" before the entities would not be hydrated together correctly.
Maybe we can find a way to optimize the renaming and stuff, it is still much simpler to do this than writing EVERYTHING by hand :-)
@doctrinebot commented on GitHub (Aug 14, 2011):
Issue was closed with resolution "Invalid"