Changes
Title
unchanged
Add model validator in Controller
Category
unchanged
Tips
Yii version
unchanged
Tags
unchanged
model, validator, Controller, custom
Content
changed
There are cases that model validators
arshould be depended by controller/action and you c
annot
ouldn't manipulate
d on the model class or using scenarios in easy way
For example, when inserting a new record we want the controller/action to deside whether or not a validator (or more than one) should be applied.
So a robust way to do that is by insert a validator to the model on Controller/action[...]