Yii查询与模型检索一起使用的错误函数

时间:2014-06-24 11:35:26

标签: mysql database yii orm models

我正在尝试修改现有函数 - 我只想传递所有行的retreive然后计算查询返回的行数

这就是我到目前为止......有人可以告诉我我做错了吗?

我获得了一个Property" AccountMenu.user"未定义错误?

        return OrganisationNews::model()->findByCriteria('
                (organisation_id=:org_id OR organisation_id=0) AND
                (site_id=:site_id OR site_id IS NULL OR site_id=:empty) AND
                (year_id=:year_id OR year_id=0) AND
                (form_name=:form_name OR form_name IS NULL OR form_name=:empty) AND
                (postcode_area=:postcode_area OR postcode_area IS NULL) AND
                active=1'.(($showRead)?'':' AND t.news_id NOT IN (SELECT onr.news_id FROM organisation_news_read onr WHERE onr.news_id=t.news_id AND onr.user_id=:user_id)'),
        array(
            ':user_id'       => $this->user->user_id,
            ':org_id'        => $this->user->organisation->organisation_id,
            ':site_id'   => $this->user->organisation->site_id,
            ':year_id'   => $this->user->year_id,
            ':form_name'     => $this->user->form_name,
            ':postcode_area' => $this->user->organisation->postcodeArea,
            ':empty'     => ''
        ));

0 个答案:

没有答案