[DDC-2229] Undefined method Created: 09/Jan/13 Updated: 22/Apr/13 Resolved: 08/Apr/13 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Karma Dordrak (Drak) | Assignee: | Benjamin Eberlei |
| Resolution: | Invalid | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
There is an undefined method called in Doctrine\ORM\Query\SqlWalker Fatal error: Call to undefined method Doctrine\ORM\Query\AST\PathExpression::isSimpleArithmeticExpression() in vendor\doctrine\orm\lib\Doctrine\ORM\Query\SqlWalker.php on line 2091 |
| Comments |
| Comment by Fabio B. Silva [ 12/Jan/13 ] |
|
Hi Karma Could you provide the failing DQL ? Cheers |
| Comment by Karma Dordrak (Drak) [ 18/Jan/13 ] |
|
It's generating SQL from a Doctrine Collection in a proxy class. Here is a link to the example: https://github.com/zikula/core/pull/674#discussion_r2696186 The SQL being generated is `SELECT t0.name AS name1, t0.value AS value2, t0.user_id AS user_id3 FROM users_attributes t0 WHERE t0.user_id = ?` The ? should be the value 2, but for some reason it's not being added. I've checked the files in the stack-trace below and the right values are entering into the process, just the wrong SQL seems to be generated. Exception Trace |
| Comment by Fabio B. Silva [ 20/Jan/13 ] |
|
Hi Drak, Could you try to write a failing test case please ? Cheers |
| Comment by Alexander [ 10/Feb/13 ] |
|
ping! |
| Comment by Daniel Huss [ 14/Feb/13 ] |
|
SqlWalker::walkInExpression() does this: $sql = $this->walkArithmeticExpression($inExpr->expression) However, $inExpr->expression could be an instance of PathExpression. The grammar allows this case: InExpression ::= SingleValuedPathExpression ["NOT"] "IN" "(" (InParameter {"," InParameter}* | Subselect) ")" PathExpression and ArithmeticExpression both extend Node, but a PathExpression is not an ArithmeticExpression, and therefore it has no method isSimpleArithmeticExpression. If you still need a failing test case, I'll write one when I get home from work. |
| Comment by Fabio B. Silva [ 14/Feb/13 ] |
|
Please Daniel Huss, A test case will be very useful.. |
| Comment by Daniel Huss [ 15/Feb/13 ] |
|
failing test case |
| Comment by Daniel Huss [ 02/Apr/13 ] |
|
Bug still present in release 2.3.3 Is someone taking care of this? It seems easy enough to fix. |
| Comment by Marco Pivetta [ 02/Apr/13 ] |
|
Daniel Huss you can open a PR with the attached patch + test. Can you do it or should I take care of it? |
| Comment by Daniel Huss [ 02/Apr/13 ] |
|
Please take care of it for me this time. I'd rather avoid the git setup until I have a significant contribution to make. |
| Comment by Benjamin Eberlei [ 08/Apr/13 ] |
|
This is invalid, you need to set the path expression differently, this is pseudo code: new ArtihmeticExpression(new SimpleArithmeticExpression(arithmeticsTerms => new PathExpression))); |
| Comment by Daniel Huss [ 22/Apr/13 ] |
|
Could this be bug in the DQL grammar, then? If I'm not mistaken, the resolution of an InExpression cannot involve an ArithmeticPrimary non-terminal. I find the correct solution as shown by Benjamin Eberlei to be quite astonishing, since a path expression like "alias.field" is not something I'd associate with the term "arithmetic". |