Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Conversation

liquorvicar
Copy link

We spotted this when using the ORM backend. Not sure if the issue also exists in the other backends?

Also, not sure if this will have any other impact (e.g. performance?)

@OskarStark
Copy link
Member

looks ok to me

ping @soullivaneuh @rande

@soullivaneuh
Copy link
Member

I don't like this because the leftJoin will be useless without the select.

@liquorvicar Could you please elaborate your issue with a concrete case?

@liquorvicar
Copy link
Author

@soullivaneuh I have updated the original issue with a concrete example (including screenshots). I see your point about the JOIN. Should I move that to where the tag criteria is checked?

@soullivaneuh
Copy link
Member

I have updated the original issue with a concrete example (including screenshots).

Could we have the issue link?

Should I move that to where the tag criteria is checked?

Don't sure to understand. If you look at the code, you will see that p is always joined. So it should be selected.

BTW, the a label should be selected too.

@liquorvicar
Copy link
Author

Original issue is here: #268

Don't sure to understand. If you look at the code, you will see that p is always joined. So it should be selected.

I think that is exactly the issue here; because t is selected then Doctrine is hydrating the Posts with the Tags that appear in the result set and not all Tags associated with the Post (because of the filter on the JOINed table then the result set is only returning Tags that match the filter).

Don't think the same issue will affect the Authors as IIRC there can only be one Author by Post.

@OskarStark OskarStark added the bug label Nov 10, 2015
@OskarStark
Copy link
Member

ping @soullivaneuh @rande

1 similar comment
@liquorvicar
Copy link
Author

ping @soullivaneuh @rande

@core23
Copy link
Member

core23 commented Feb 11, 2016

Have you tried a second join @liquorvicar

         if (isset($criteria['tag'])) {
             $query
                 ->leftJoin('p.tags', 't2', Join::WITH)
                 ->andWhere('t2.slug LIKE :tag');
             $parameters['tag'] = (string) $criteria['tag'];
         }

@core23
Copy link
Member

core23 commented Apr 16, 2016

Ping @liquorvicar

@liquorvicar
Copy link
Author

@core23 Sorry, I'm not working on this project at the moment (and in fact I'm not working with php either for now). Not going to have the time to clear this up but I'm not sure your suggested solution is any better. I'll ping one of my old colleagues in case they can help as they are probably still using this library (@catharsisjelly)

@soullivaneuh
Copy link
Member

According to the new Sonata version management and next major release plan, this project has been refactored regarding branching and versioning.

If you see this message, your PR concerns a patch or a minor release and is not targeting the right branch.

So I'm closing this one, but don't see it as a refusal. If you think your work is still relevant and want to continue, feel free to reopen it on the right branch (e.g. the default one).

Regards.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants