Lost criteria when using 2 static A/R models (Yii 1.1.6)

Hi! I wonder if this is a bug. I created a static A/R model, and in the middle of specifying some criteria I used the same static model with findByPk. When I went back to using the first model, all criteria were lost.




$model = ARModel::model()

           ->validItems(); // a simple scope

    

var_dump($model->getDbCriteria()); // criteria is ok here

  

ARModel::model()->findByPk(1);

    

// criteria will be LOST here

// The effect of the validItems() disappears

var_dump($model->getDbCriteria());



Try to use $this instead of


ARModel::model()

Its the way Yii is designed, ::model() will get an instance of the same class you are using and do the query