使用 Propel addCond 检查条目是否为 NULL

Using Propel addCond to check if an entry is NULL

我有以下推进条件:

->addCond('cond3', 're.max_person_count', Criteria::ISNULL)

这会产生以下错误:Invalid text representation: 7 ERROR: invalid input syntax for integer: „NULL“

经过仔细检查,生成的 SQL 似乎如下所示:

... (re.max_person_count=:p3 OR ...

而不是期望的:

... (re.max_person_count IS NULL OR ...

为什么当我选择的 CriteriaISNULL 时 Propel 试图插入一个值?我做错了什么?

似乎使用 Criteria::ISNULL 会产生一些我无法解释的不可预测的行为(相应生成的 SQL 尝试没有映射到 IS NULL)。

这是最终结果,如我所愿(以防有人需要回答问题):

   $resQuery = ResQuery::create()
        ->leftJoinTable('tbl')
        ->addCond('cond1', 'tbl_id', $tableId, Criteria::EQUAL)
        ->addCond('cond2', 'canceled', 'FALSE', Criteria::EQUAL)
        ->combine(array('cond1','cond2'), 'AND', 'cond1and2')
        ->addCond('cond3', 'tbl.max_count', null)
        ->addCond('cond4', 'tbl.max_count', '0', Criteria::GREATER_THAN)
        ->addCond('cond5', 'confirmed', 'TRUE', Criteria::EQUAL)
        ->combine(array('cond4', 'cond5'), 'AND', 'cond4and5')
        ->combine(array('cond3', 'cond4and5'), 'OR', 'cond3or4and5')
        ->where(array('cond1and2', 'cond3or4and5'), 'AND')
        ->find();