im having troubles with checking boolean field with "is not true" clause im getting this error:
("[Syntax Error] line 0, col 510: Error: Expected =, <, <=, <>, >, >=, !=, got 'IS'")
query is build with dql. so in code i have it added like this
$dql .= " AND p.archived IS NOT TRUE ";
executed query:
SELECT COUNT(p.id)
FROM Sandbox\WebsiteBundle\Entity\Pages\OfferPage p
INNER JOIN Kunstmaan\NodeBundle\Entity\NodeVersion nv WITH nv.refId = p.id
INNER JOIN Kunstmaan\NodeBundle\Entity\NodeTranslation nt WITH nt.publicNodeVersion = nv.id and nt.id = nv.nodeTranslation
INNER JOIN Kunstmaan\NodeBundle\Entity\Node n WITH n.id = nt.node WHERE n.deleted = 0
AND n.hiddenFromNav = 0
AND n.refEntityName = 'Sandbox\WebsiteBundle\Entity\Pages\OfferPage'
AND nt.online = 1 AND nt.lang = :lang AND p.archived IS NOT TRUE AND p.expirationDate >= :date ORDER BY p.price ASC
Normally when you have a boolean configured in Doctrine you have an integer field with 0 or 1. Its much easier to check if the value is
0
or1
.or another solution:
or if you check to
null
When you look at the page you can see some expression.
IS
can't be used in that context.http://doctrine1-formerly-known-as-doctrine.readthedocs.org/en/latest/en/manual/dql-doctrine-query-language.html
And here is another link to show you how to use
where in
andwhere not in
http://www.ozonesolutions.com/programming/2011/09/symfony-doctrine-where-in-and-where-not-in-syntax/