mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-478: $qb->expr()->between("alias.myfield", $minValue, $maxValue) cannot be parsed into valid SQL #595
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Mar 26, 2010).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user mzach:
When using the between() method of the Doctrine\ORM\Query\Expr class, an instance of Doctrine\ORM\Query\Expr\Func is returned, which produces a DQL similar to:
SELECT p FROM MyTest\Domain\Person p WHERE BETWEEN(p.id, 1, 100)
This is expected behaviour following the test available in Doctrine/Tests/ORM/Query/ExprTest.php, unfortunately the parser itself as well as other testcases expect the format to be
SELECT p FROM MyTest\Domain\Person p WHERE p.id BETWEEN 1 AND 100
So every time you call getSql() Doctrine throws an Exception because it tries to access BETWEEN() as a database function, whereas it really is a comparator.
I made a quick fix available at http://www.pastie.org/888251 to solve this issue by keeping the parser as-is and only rewriting the returned class
HTH
Regards,
Michael
@doctrinebot commented on GitHub (Mar 26, 2010):
Comment created by mzach:
Attached modified classes for easier review
@doctrinebot commented on GitHub (Mar 28, 2010):
Comment created by @beberlei:
Fixed
@doctrinebot commented on GitHub (Mar 28, 2010):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 3 attachments from Jira into https://gist.github.com/9f0d5e12e7051df5a6f4