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.
Esempio n. 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');
 }
 public function setScenario($scenario)
 {
     if (array_key_exists($scenario, $this->scenarios())) {
         parent::setScenario($scenario);
     }
 }