Hi,
is there a way to apply a rule on Model by condition?
I mean something like that
instead of
to avoid the repeateding set of scenario in Controllers/action
if there is no way yet, may be included in yii 2
is there a way to apply a rule on Model by condition?
I mean something like that
public function rules() { array('specialattribute', 'numerical', 'integerOnly' => true, 'when'=>'Yii::app()->user->checkAccess("superadmin") or a method'), }
instead of
public function rules() { array('specialattribute', 'numerical', 'integerOnly' => true, 'on'=>'superadmin'), }
to avoid the repeateding set of scenario in Controllers/action
if there is no way yet, may be included in yii 2
