Revision #10 has been created by spinningarrow on Apr 6, 2012, 12:15:35 PM with the memo:
minor edit (insure -> ensure)
« previous (#9) next (#11) »
Changes
Title
unchanged
Understanding "Safe" Validation Rules
Category
unchanged
FAQs
Yii version
unchanged
Tags
unchanged
Forms, Validation, Safe, Massive Assignment, understanding
Content
changed
A common source of confusion among new Yii users is how the `'safe'` validator works, how it works with other validators, and why it's necessary in the first place. This article means to clear up this confusion, as well as explain the notion of Massive Assignment.
Summary: A model's validation rules serve **two** purposes:
1.
IEnsure that fields entered in a form are entered properly
2. Define which form fields are allowed to be assigned to a $model variable
These are related, but not the same, and the distinction is important.
Looking at a set of validation rules[...]