Cookie过期时Yii中的奇怪错误

时间:2015-09-08 09:38:54

标签: php cookies yii

当Cookie在Yii中过期时,我遇到了问题。一切似乎与其他表格一起使用。当cookie过期时,用户将在登录页面中重定向。但我在特定模型中遇到问题。在此模型中,当cookie过期时,它不仅不会注销用户,而且还会返回错误的结果。我认为我的模型search()方法可能有问题。但我无法弄清楚是什么。一切都很正常。这是代码:

public function search()
{
        // @todo Please modify the following code to remove attributes that should not be searched.
        $criteria = new CDbCriteria;
        $criteria->compare('contractid',$this->contractid);
        $criteria->compare('t.schoolclassid',$this->schoolclassid);
        $criteria->compare('schoolclass.schoolid',$this->schoolid);
        $criteria->compare('schoolclass.gradeid',$this->gradeid);
        $criteria->compare('t.studentid',$this->studentid);
        $criteria->compare('regno',$this->regno);
        $criteria->compare('contractdate',$this->contractdate,true);
        $criteria->compare('startdate',$this->startdate,true);
        $criteria->compare('pausedate',$this->pausedate,true);
        $criteria->compare('enddate',$this->enddate,true);
        $criteria->compare('totalcost',$this->totalcost,true);
        $criteria->compare('totalxcost',$this->totalxcost,true);
        $criteria->compare('closed',$this->closed);
        //For Filtering with Student
        $criteria->with = array('student','schoolclass.school');
        if (Yii::app()->user->CompanyID) {
           $criteria->compare('school.companyid',Yii::app()->user->CompanyID);
        }
        if (Yii::app()->user->SchoolID) {
            $criteria->compare('schoolclass.schoolid',Yii::app()->user->SchoolID);
        }
        $criteria->addSearchCondition('student.lastname', $this->studentLastname);
        $criteria->addSearchCondition('student.firstname', $this->studentFirstname);

        return new CActiveDataProvider($this, array(
            'criteria'=>$criteria,
            'sort'=>array(
                'defaultOrder'=>'student.lastname ASC',
            ),
            'pagination'=>array(
                'pageSize'=>50,               
            ),
        ));          
}

有人可以解释导致此问题的原因吗?或建议一个解决方法?

0 个答案:

没有答案