Reputation: 1699
I am trying to get records from a table where patentgroup_id is null. I tried this
$repository = $this->getDoctrine()->getRepository('MunichInnovationGroupPatentBundle:SvPatents');
$qb1 = $repository->createQueryBuilder('sv')
->select('sv')
->where('sv.patentgroup = :patentgroup')
->setParameter('patentgroup', null)
->getQuery();
$nogroup_patents = $qb1->getArrayResult();
var_dump($nogroup_patents);
There is one record in the table whose patentgroup_id is null but I am getting empty array.
Any ideas? What I am doing wrong
thanks
Upvotes: 0
Views: 3600
Reputation: 6927
same way you would do it in SQL
->where('sv.patentgroup IS NULL')
Upvotes: 1