gpt4 book ai didi

symfony - 语法错误: line 0, col 81 : Error: Expected Literal,得到了 'NULL'

转载 作者:行者123 更新时间:2023-12-04 13:23:12 29 4
gpt4 key购买 nike

尝试通过查询生成器执行查询时收到错误[Syntax Error] line 0, col 81: Error: Expected Literal, got 'NULL'

        $qb = $this->createQueryBuilder('r')
->select('r')
->where('r.query = :query')
->setParameter('query', $query)
->andWhere('r.lang = NULL')
;

return $qb->getQuery()->getOneOrNullResult();
r.lang字段定义为:
/**
* @var integer
*
* @ORM\ManyToOne(targetEntity="\BW\LocalizationBundle\Entity\Lang")
* @ORM\JoinColumn(name="lang_id", referencedColumnName="id")
*/
private $lang;

帮助解决错误,请

最佳答案

当您检查NULL值时,表达式应为

->andWhere('r.lang IS NULL')

关于symfony - 语法错误: line 0, col 81 : Error: Expected Literal,得到了 'NULL',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21606207/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com