Doctrine Project

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Doctrine 2 - ORM
  • Doctrine 2 - ORM
  • DDC-2229

Undefined method

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Invalid
  • Affects Version/s: 2.3
  • Fix Version/s: None
  • Component/s: ORM
  • Labels:
    None

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

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. File
    SqlWalkerTest.php
    15/Feb/13 2:17 PM
    1 kB
    Daniel Huss
  2. Text File
    SqlWalker.patch
    02/Apr/13 10:02 AM
    0.7 kB
    Daniel Huss

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
  • Source
Hide
Permalink
Fabio B. Silva added a comment - 12/Jan/13 9:01 PM

Hi Karma

Could you provide the failing DQL ?

Cheers

Show
Fabio B. Silva added a comment - 12/Jan/13 9:01 PM Hi Karma Could you provide the failing DQL ? Cheers
Hide
Permalink
Karma Dordrak (Drak) added a comment - 18/Jan/13 3:57 PM

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
#0 Exception thrown in C:\xampp\htdocs\core13\src\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php, line 47.
#1 C:\xampp\htdocs\core13\src\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\BasicEntityPersister.php(1599): Doctrine\DBAL\Connection->executeQuery('SELECT t0.name ...', Array, Array)
#2 C:\xampp\htdocs\core13\src\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\BasicEntityPersister.php(1558): Doctrine\ORM\Persisters\BasicEntityPersister->getOneToManyStatement(Array, Object(Users\Entity\User))
#3 C:\xampp\htdocs\core13\src\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php(2673): Doctrine\ORM\Persisters\BasicEntityPersister->loadOneToManyCollection(Array, Object(Users\Entity\User), Object(Doctrine\ORM\PersistentCollection))
#4 C:\xampp\htdocs\core13\src\vendor\doctrine\orm\lib\Doctrine\ORM\PersistentCollection.php(224): Doctrine\ORM\UnitOfWork->loadCollection(Object(Doctrine\ORM\PersistentCollection))
#5 C:\xampp\htdocs\core13\src\vendor\doctrine\orm\lib\Doctrine\ORM\PersistentCollection.php(576): Doctrine\ORM\PersistentCollection->initialize()
#6 C:\xampp\htdocs\core13\src\lib\util\UserUtil.php(1152): Doctrine\ORM\PersistentCollection->getIterator()
#7 C:\xampp\htdocs\core13\src\lib\util\UserUtil.php(2007): UserUtil::getVars('admin', false, 'uname', false)

Show
Karma Dordrak (Drak) added a comment - 18/Jan/13 3:57 PM 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 #0 Exception thrown in C:\xampp\htdocs\core13\src\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php, line 47. #1 C:\xampp\htdocs\core13\src\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\BasicEntityPersister.php(1599): Doctrine\DBAL\Connection->executeQuery('SELECT t0.name ...', Array, Array) #2 C:\xampp\htdocs\core13\src\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\BasicEntityPersister.php(1558): Doctrine\ORM\Persisters\BasicEntityPersister->getOneToManyStatement(Array, Object(Users\Entity\User)) #3 C:\xampp\htdocs\core13\src\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php(2673): Doctrine\ORM\Persisters\BasicEntityPersister->loadOneToManyCollection(Array, Object(Users\Entity\User), Object(Doctrine\ORM\PersistentCollection)) #4 C:\xampp\htdocs\core13\src\vendor\doctrine\orm\lib\Doctrine\ORM\PersistentCollection.php(224): Doctrine\ORM\UnitOfWork->loadCollection(Object(Doctrine\ORM\PersistentCollection)) #5 C:\xampp\htdocs\core13\src\vendor\doctrine\orm\lib\Doctrine\ORM\PersistentCollection.php(576): Doctrine\ORM\PersistentCollection->initialize() #6 C:\xampp\htdocs\core13\src\lib\util\UserUtil.php(1152): Doctrine\ORM\PersistentCollection->getIterator() #7 C:\xampp\htdocs\core13\src\lib\util\UserUtil.php(2007): UserUtil::getVars('admin', false, 'uname', false)
Hide
Permalink
Fabio B. Silva added a comment - 20/Jan/13 12:03 PM

Hi Drak,

Could you try to write a failing test case please ?

Cheers

Show
Fabio B. Silva added a comment - 20/Jan/13 12:03 PM Hi Drak, Could you try to write a failing test case please ? Cheers
Hide
Permalink
Alexander added a comment - 10/Feb/13 11:48 AM

ping!

Show
Alexander added a comment - 10/Feb/13 11:48 AM ping!
Hide
Permalink
Daniel Huss added a comment - 14/Feb/13 5:53 PM

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.

Show
Daniel Huss added a comment - 14/Feb/13 5:53 PM 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.
Hide
Permalink
Fabio B. Silva added a comment - 14/Feb/13 6:21 PM

Please Daniel Huss, A test case will be very useful..

Show
Fabio B. Silva added a comment - 14/Feb/13 6:21 PM Please Daniel Huss, A test case will be very useful..
Hide
Permalink
Daniel Huss added a comment - 15/Feb/13 2:17 PM

failing test case

Show
Daniel Huss added a comment - 15/Feb/13 2:17 PM failing test case
Hide
Permalink
Daniel Huss added a comment - 02/Apr/13 10:02 AM

Bug still present in release 2.3.3

Is someone taking care of this? It seems easy enough to fix.

Show
Daniel Huss added a comment - 02/Apr/13 10:02 AM Bug still present in release 2.3.3 Is someone taking care of this? It seems easy enough to fix.
Hide
Permalink
Marco Pivetta added a comment - 02/Apr/13 10:06 AM

Daniel Huss you can open a PR with the attached patch + test. Can you do it or should I take care of it?

Show
Marco Pivetta added a comment - 02/Apr/13 10:06 AM Daniel Huss you can open a PR with the attached patch + test. Can you do it or should I take care of it?
Hide
Permalink
Daniel Huss added a comment - 02/Apr/13 12:55 PM

Please take care of it for me this time. I'd rather avoid the git setup until I have a significant contribution to make.

Show
Daniel Huss added a comment - 02/Apr/13 12:55 PM Please take care of it for me this time. I'd rather avoid the git setup until I have a significant contribution to make.
Hide
Permalink
Benjamin Eberlei added a comment - 08/Apr/13 8:26 PM

This is invalid, you need to set the path expression differently, this is pseudo code:

new ArtihmeticExpression(new SimpleArithmeticExpression(arithmeticsTerms => new PathExpression)));
Show
Benjamin Eberlei added a comment - 08/Apr/13 8:26 PM This is invalid, you need to set the path expression differently, this is pseudo code: new ArtihmeticExpression( new SimpleArithmeticExpression(arithmeticsTerms => new PathExpression)));
Hide
Permalink
Daniel Huss added a comment - 22/Apr/13 11:17 AM

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".

Show
Daniel Huss added a comment - 22/Apr/13 11:17 AM 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".

People

  • Assignee:
    Benjamin Eberlei
    Reporter:
    Karma Dordrak (Drak)
Vote (0)
Watch (6)

Dates

  • Created:
    09/Jan/13 2:55 PM
    Updated:
    22/Apr/13 11:17 AM
    Resolved:
    08/Apr/13 8:26 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Doctrine Project. Try JIRA - bug tracking software for your team.