mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-2539: ResultVariable cannot be used in Like expressions #3187
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 (Jul 2, 2013).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user sergei:
It is not possible to use ResultVariable in a like expression. For exemple :
$qb ->select('c', 'SQRT(c.id) AS test')
->from('SomeClass', 'c')
->having('test LIKE '%4%'');
return [Syntax Error] line 0, col 91: Error: Expected Literal, got 'LIKE'
$qb ->select('c')
->from('SomeClass', 'c')
->having('c.id LIKE '%4%'');
works, and :
$qb ->select('c', 'SQRT(c.id) AS test')
->from('SomeClass', 'c')
->having('test = 4');
works
Changing Doctrine\ORM\Query\Parser LikeExpression function fix the problem (but has maby other consequences) :
by replacing : "$stringExpr = $this->StringExpression();"
by :
$peek = $this->_lexer->glimpse();
if($peek['value'] == 'LIKE') { // Simple Expression
$stringExpr = $this->ArithmeticExpression();
} else {
$stringExpr = $this->StringExpression();
}
@doctrinebot commented on GitHub (Aug 26, 2013):
Comment created by sergei:
After working on this issue, i really think it's a bug. I just add more details on the description
@doctrinebot commented on GitHub (Aug 26, 2013):
Comment created by @ocramius:
Duplicate of DDC-2615 (solved in master)
@doctrinebot commented on GitHub (Aug 26, 2013):
Issue was closed with resolution "Duplicate"