To me, scenario is useful. For example when writing different scenarios at the validation rules() or events(beforeSave, afterSave) in Active Record. But when the Active Record become complex the number of scenarios become more and more. When there are too many scenarios, I think it would be better if we can just group some of scenarios into one name, and we only need to define that name
for example like this code:
<?php
public function scenarios()
{
return array(
'generalScenarios'=>array('registration','changeProfile'),
);
}
public function rules() {
return array(
array('name, username', 'required', 'on'=>'generalScenarios'),
);
}
public function afterSave()
{
if ($this->checkScenario('generalScenarios')){
//do something
}
}