Symfony2 Doctrine Expr 'IS NOT NULL'

后端 未结 1 1563
无人共我
无人共我 2021-02-11 14:39

I\'m using the FormType for an Entity of mine, and setting up an entity field. I need two Where clauses in an And, an

相关标签:
1条回答
  • 2021-02-11 15:37

    You can use isNotNull:

    'query_builder' => function ($er){
        $qb = $er->createQueryBuilder('p');
        $qb
            ->where($qb->expr()->andx(
                $qb->expr()->in('p', '?1'),
                $qb->expr()->isNotNull('p.location')
            ))
            ->setParameter(1, $this->totalScope);
    
        return $qb;
    },
    
    0 讨论(0)
提交回复
热议问题