Mr *_*r B 71 php null doctrine dql
我在Zend中使用Doctrine 1.1.我正在尝试编写一个查询,该查询将返回某列中具有空值的记录.
    $q = Doctrine_Query::create()
    ->select('a.*')
    ->from('RuleSet a')
    ->where('a.vertical_id = ?', null);
    $ruleset_names_result = $q->execute(array(), Doctrine::HYDRATE_ARRAY);
我在ruleset表中有三条记录,它们在vertical_id列中具有NULL值,但查询找不到这些记录.
感谢帮助.
希德.
Joh*_*nes 150
我使用symfony的教义,这就是我的方式:
where('a.vertical_id is NULL');
小智 8
使用此代码:
->where($qb->expr()->isNull('a.vertical_id'));
参考:http:
//docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/query-builder.html#the-expr-class