-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failing test for GH8443 #8855
Failing test for GH8443 #8855
Conversation
Continuation of a problem from doctrine#6812 The same problem appears if you add WITH condition to the joined entity with discriminator
20be56e
to
86703cb
Compare
As opposed to what? #6812 is also about |
You're right. In both issues the problem was a result of using a with condition. I think the code of SqlWalker::walkJoinAssociationDeclaration could be simplfy a little and the #8443 wouldn't be necessary, but then the code doesn't pass some tests of the SelectSqlGeneratorTest, even though the sql syntax is correct. |
I'll rephrase my question: what is the difference between both issues? Since the first patch did not fix the second issue, there must be some difference somewhere, right? |
The sqls are generated in different methods with different logic. |
Ok, why is that? |
I haven't designed the SqlWalker, but I see that, in the terms of the EBNF of DQL, the logic of the generation of Join is more complex when we join JoinAssociationDeclaration than when we join RangeVariableDeclaration . Some of the logic is similar and maybe it would be possible to put that logic in a separate method. |
Ah, so that's the difference! How do each of these look like in DQL? |
A JoinAssociationDeclaration is a path to an entity's field (the field can be a collection of entities, a single entity or a simple state field) plus an alias: p.friend AS f (p must be defined before and that's one of the differences with the next one). A RangeVariableDeclaration is a path to a class plus an alias: \MyNamespace\Person AS p. A RangeVariableDeclaration is the obligatory component that must be placed immediately after the "FROM" clause. A JoinAssociationDeclaration can be only used as a joined component while A RangeVariableDeclaration can be used as a joined component and a starting point/base of an IdentificationVariableDeclaration which is a building block of the "FROM" clause. How does the method responsible for generating joins work? The logic of the generation of the optional brackets (the subject of our discussion) is put in the method that is reponsible for generating JoinAssociationDeclaration, if the Join is a JoinAssociationDeclaration, and is put in the method that is responsible for generating joins, if the Join is a RangeVariableDeclaration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clear! Thank you!
Thanks @piowin! |
A test suit for #8443.
Closes #8443