/** * Returns a list of scenarios and the corresponding active attributes. * An active attribute is one that is subject to validation in the current scenario. * The returned array should be in the following format: * * ~~~ * [ * 'scenario1' => ['attribute11', 'attribute12', ...], * 'scenario2' => ['attribute21', 'attribute22', ...], * ... * ] * ~~~ * * By default, an active attribute is considered safe and can be massively assigned. * If an attribute should NOT be massively assigned (thus considered unsafe), * please prefix the attribute with an exclamation character (e.g. '!rank'). * * The default implementation of this method will return all scenarios found in the [[rules()]] * declaration. Three special scenarios named [[SCENARIO_DEFAULT]], [[SCENARIO_CREATE]] * and [[SCENARIO_UPDATE]] will contain all attributes found in the [[rules()]]. * Each scenario will be associated with the attributes that * are being validated by the validation rules that apply to the scenario. * * @return array a list of scenarios and the corresponding active attributes. */ public function scenarios() { $scenarios = parent::scenarios(); $scenarios[self::SCENARIO_CREATE] = ['parentId', 'pageId', 'name', 'color', 'order']; $scenarios[self::SCENARIO_UPDATE] = ['jsonConfig']; return $scenarios; }
/** * Returns a list of scenarios and the corresponding active attributes. * Add the 'createBasic' and 'addComponents' scenario and update 'update' scenario * @return array a list of scenarios and the corresponding active attributes. */ public function scenarios() { $scenarios = parent::scenarios(); $scenarios['createBasic'] = ['title', 'url', 'shortUrl', 'description', 'type', 'isFinished', 'count', 'deletable', 'color']; $scenarios['addComponents'] = ['color', 'cpts']; $scenarios[self::SCENARIO_UPDATE] = ['title', 'description']; return $scenarios; }
public function scenarios() { $scenarios = parent::scenarios(); $scenarios['register'] = ['priceType', 'enabledMods', 'availableExtMods', 'tags']; return $scenarios; }
public function scenarios() { return array_merge(parent::scenarios(), ['update' => ['name', 'order', 'isRequired']]); }