yii\base\Model::setScenario PHP Method

setScenario() public method

Note that this method does not check if the scenario exists or not. The method Model::validate will perform this check.
public setScenario ( string $value )
$value string the scenario that this model is in.
    public function setScenario($value)
    {
        $this->_scenario = $value;
    }

Usage Example

Beispiel #1
0
 /**
  * Init.
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     if (!isset($this->id)) {
         throw new InvalidConfigException(get_class($this) . '::$id');
     }
     if (!$this->model instanceof Model) {
         throw new InvalidConfigException(get_class($this) . '::$model');
     }
     $this->model->setScenario('sync');
 }
All Usage Examples Of yii\base\Model::setScenario