我想从表中选择所有不是空的行。我试着这样做:
$qb = $this->getDoctrine()->getManager()->createQueryBuilder();
$qb->select('p')
->from('\Vputi\UserBundle\Entity\Profile', 'p')
->where('p.driverLicence != :literal')
->setParameter('literal', null);
var_dump($qb->getQuery()->getResult());die;
但只获得空阵列。我的问题在哪里?
答案 0 :(得分:1)
更改行:
->where('p.driverLicence != :literal')
到:
->where('p.driverLicence is not NULL')