src/Collection.php
public function setModel($model)
    {
        if ($model instanceof Model) {
            $this->model = $model;
        } else {
            $this->model = Yii::createObject($model);
        }

        $model = $this->model;
        $this->updateFormName();

        if (empty($this->getScenario())) {
            $this->setScenario($model->scenario);
        }

        return $this->model;
    }
public function setModel($model)
    {
        if ($model instanceof Model) {
            $this->model = $model;
        } else {
            $this->model = Yii::createObject($model);
        }

        $model = $this->model;
        $this->updateFormName();

        if (empty($this->getScenario())) {
            $this->setScenario($model->scenario);
        }

        return $this->model;
    }
public function setModel ( $ model ) { if ( $ model instanceof Model ) { $ this -> model = $ model ; } else { $ this -> model = Yii :: createObject ( $ model ) ; } $ model = $ this -> model ; $ this -> updateFormName ( ) ; if ( empty ( $ this -> getScenario ( ) ) ) { $ this -> setScenario ( $ model -> scenario ) ; } return $ this -> model ; }
Sets the model of the collection.
@param ActiveRecord|array $model if the model is an instance of [[Model]] - sets it, otherwise - creates the model
using given options array
@return object|ActiveRecord
Sets the model of the collection .