I have 2 active records one FrEvent and another FrUsers. In FrEvent:
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'frUser' => array(self::BELONGS_TO, 'FrUsers', 'fr_users_id'),
);
}
public function defaultScope()
{
$criteria = new CDbCriteria(parent::defaultScope());
$criteria->compare('fr_users_id', Yii::app()->user->id);
return $criteria->toArray();
}
in some cases i do not need to load only that current user so i am using resetScope.
FrEvent::model()->resetScope()->findAll();
this is ok, default scope is ignored. but when i am trying to get event users the active record initialized scopes.
how to make that it won’t call this method or be ignore? One think I can ignore default scope and make other function to call it when it need but there will be additional writing code.