How to install the scenario in yii ActiveRecord DadaProvider for each model;By default should update
public function afterFind()
{
if ($this->scenario === 'searchView') {
//myCode
}
parent::afterFind();
}
public function searchView()
{
$criteria = new CDbCriteria([
'select' => 'last_comment,name,data,cdate,mdate,edate,coperator,eoperator',
'with' => ['houses', 'houses.city', 'houses.district', 'houses.street', 'stages']
]);
return new CActiveDataProvider($this, [
'criteria' => $criteria,
'sort' => [
'defaultOrder' => 'cdate DESC'
]);
}