如示例中的可用电影未显示正确的计算字段


Available Movies as in example is not showing correct calculated field

链接

http://agiletoolkit.org/learn/app/logic 后面跟着计算字段

// add into Model_DVD_InStore
function dsql_count(){
    return $this
        ->dsql(null,false)
        ->field('count(*)')
        ->where('('.$this->calculate_is_rented().')!=','Y')
        ->where('dvd.movie_id=movie.id')
        ;
}
但这是一个内部连接,所有租用的DVD(在租用

表中有条目)和返回的DVD都被考虑在内,但所有尚未租用的DVD都不考虑在内。

解决::

使用 Agile Toolkit 4.2(

您需要 Git 版本或 4.2.1),您可以使用以下内容:

$model->count();

它返回具有应用条件的 DSQL。