Yii Active Record how to install scenario for each models in DataProvider ?
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']
]);
$model = $this;
//$model->scenario = 'searchView'; this is for dataprovider
return new CActiveDataProvider($model , [
'criteria' => $criteria,
'sort' => [
'defaultOrder' => 'cdate DESC'
],
'pagination' => $this->searchFrom || $this->searchTo || $this->district_key || $this->city_key ? false : ['pageSize' => 100]
])
;
}