required vs allowEmpty


I’m not sure to understand when to use the required yii built-in validator and the allowEmpty attribute attached to other Yii built-in validators. For me it’s seems to be redundant and a possible cause of confusion.

Does anyone knows the difference ?



Sometimes an attribute could be optional, and in this case, you don't want to use the 'required' validator.

yes of course … sorry for the silly question … I thought the rule was

 'required' => true

obviously time to take some sleep ;)