fix eager, left join if previous was a left join#789
Conversation
| } | ||
|
|
||
| $joinColumns = $mapping['joinColumns'] ?? $mapping['joinTable']['joinColumns'] ?? null; | ||
| if ($wasLeftJoin === false) { |
|
Thanks @soyuka |
fix eager, left join if previous was a left join
|
@soyuka SELECT DISTINCT a0_.id AS id_0, a0_.id AS id_1, a0_.id AS id_2 FROM app_manufactured_item a0_ LEFT JOIN sylius_order_item_unit s1_ ON a0_.order_item_unit_id = s1_.id LEFT JOIN sylius_order_item s2_ ON s1_.order_item_id = s2_.id INNER JOIN app_attachment_item a3_ ON a0_.attachment_item_id = a3_.idWhat is the rule to decide if it should join with inner or left ? I'm using an Existfilter and it adds the join by using the function addJoinsForNestedProperty from Abstractfilter. The addJoinOnce function seems to decide to add only inner joins. |
|
@wadjeroudi it should only join once (code ref). What version are you using? May you open a new issue to track this? Thanks! |
|
@soyuka Thx for your answer. The problem is not about the join added one time, but it's about the type of the join: inner vs left join. addJoinOnce seems to only add inner join. But you can see on my generated request that my first join was a left join. Is there any logic implemented ? |
|
@wadjeroudi indeed we don't specify what type the join should be there. I'll work on a patch to fix this. |
When doing a
LEFTjoin, the next association that should be fetched inEAGERmode was doing anINNERjoin. As a result, there were things missing from the end results.