DDC-3763: Passing "false" boolean value to eq() function in query builder does not end up SQL query #4614

Closed
opened 2026-01-22 14:45:58 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 9, 2015).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user danijeld:

$qb->andWhere($qb->expr()->eq('d.active', true));

produces:

[_dql:Doctrine\ORM\Query:private] => SELECT COUNT(r.id) FROM Game:Roll r INNER JOIN r.hand d WHERE d.userId = :userId AND d.active = 1

$qb->andWhere($qb->expr()->eq('d.active', false));

produces:

[_dql:Doctrine\ORM\Query:private] => SELECT COUNT(r.id) FROM Game:Roll r INNER JOIN r.hand d WHERE d.userId = :userId AND d.active =

and this query fails with an error:

[Syntax Error] line 0, col -1: Error: Expected Literal, got end of string.

As a workaround I am using 1 and 0 instead of "true" and "false"

Originally created by @doctrinebot on GitHub (Jun 9, 2015). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user danijeld: $qb->andWhere($qb->expr()->eq('d.active', true)); produces: [_dql:Doctrine\ORM\Query:private] => SELECT COUNT(r.id) FROM Game:Roll r INNER JOIN r.hand d WHERE d.userId = :userId AND d.active = 1 $qb->andWhere($qb->expr()->eq('d.active', false)); produces: [_dql:Doctrine\ORM\Query:private] => SELECT COUNT(r.id) FROM Game:Roll r INNER JOIN r.hand d WHERE d.userId = :userId AND d.active = and this query fails with an error: [Syntax Error] line 0, col -1: Error: Expected Literal, got end of string. As a workaround I am using 1 and 0 instead of "true" and "false"
admin added the Bug label 2026-01-22 14:45:58 +01:00
admin closed this issue 2026-01-22 14:45:59 +01:00
Author
Owner
@doctrinebot commented on GitHub (Jun 9, 2015): - duplicates [DDC-3762: Passing "false" boolean value to eq() function in query builder does not end up SQL query](http://www.doctrine-project.org/jira/browse/DDC-3762)
Author
Owner

@doctrinebot commented on GitHub (Jun 9, 2015):

Issue was closed with resolution "Duplicate"

@doctrinebot commented on GitHub (Jun 9, 2015): Issue was closed with resolution "Duplicate"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4614