hiho.. i have implemented a AST Function for "FIND_IN_LIST":
class FindInSetFunction extends FunctionNode {
public $needle = null;
public $haystack = null;
public function parse(Parser $parser) {
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->needle = $parser->ArithmeticPrimary();
$parser->match(Lexer::T_COMMA);
$this->haystack = $parser->ArithmeticPrimary();
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
public function getSql(SqlWalker $sqlWalker) {
return sprintf(
'FIND_IN_SET(%s, %s)',
$this->needle->dispatch($sqlWalker),
$this->haystack->dispatch($sqlWalker)
);
}
}
this works fine, but with one downside:
$qb->where(
$qb->expr()->gt(
sprintf('FIND_IN_SET(:country, entity.countries)')),
0
)
);
i have to compare it with zero. without this check, i get this error:
#0 .../vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(448):
> Doctrine\ORM\Query\QueryException::dqlError('SELECT entity F...')
> #1 .../vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(3317):
> Doctrine\ORM\Query\Parser->syntaxError('=, <, <=, <>, >...')
> #2 .../vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(3032):
> Doctrine\ORM\Query\Parser->ComparisonOperator()
> #3 .../vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(2556):
> Doctrine\ORM\Query\Parser->ComparisonExpression()
>
how can i prevent this?
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.