DDC-1311: ResultSetMappingBuilder breaks on bidirectional association mapping #1645

Closed
opened 2026-01-22 13:20:52 +01:00 by admin · 4 comments
Owner

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.

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](http://www.doctrine-project.org/jira/browse/DDC-1725). Will try to write some testcases.
admin added the Bug label 2026-01-22 13:20:52 +01:00
admin closed this issue 2026-01-22 13:20:54 +01:00
Author
Owner

@doctrinebot commented on GitHub (Aug 6, 2011):

Comment created by @beberlei:

What is DDC-1725? :)

@doctrinebot commented on GitHub (Aug 6, 2011): Comment created by @beberlei: What is [DDC-1725](http://www.doctrine-project.org/jira/browse/DDC-1725)? :)
Author
Owner

@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:

  • products
    -- id
    -- name
  • product_stock_country
    -- product_id
    -- stock
    -- country
  • product_sales
    -- 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 9, 2011): Comment created by @asm89: Ah, that had to be [DDC-1275](http://www.doctrine-project.org/jira/browse/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: - products -- id -- name - product_stock_country -- product_id -- stock -- country - product_sales -- 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.
Author
Owner

@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): 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 :-)
Author
Owner

@doctrinebot commented on GitHub (Aug 14, 2011):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Aug 14, 2011): Issue was closed with resolution "Invalid"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1645