I got an error [Syntax Error] line 0, col 81: Error: Expected Literal, got 'NULL'
when I try to execute query via query builder
$qb = $this->createQueryBuilder('r')
->select('r')
->where('r.query = :query')
->setParameter('query', $query)
->andWhere('r.lang = NULL')
;
return $qb->getQuery()->getOneOrNullResult();
r.lang
field is defined as:
/**
* @var integer
*
* @ORM\ManyToOne(targetEntity="\BW\LocalizationBundle\Entity\Lang")
* @ORM\JoinColumn(name="lang_id", referencedColumnName="id")
*/
private $lang;
Help to solve error, please
When you check for NULL value the expression should be
->andWhere('r.lang IS NULL')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With