I want to specify the following in my model:
that an attribute is required if another attribute is not set.
so if the person did not provide a value for attribute1 than attribute2 is required.
How can I do that using the model ruleS?
I want to specify the following in my model:
that an attribute is required if another attribute is not set.
so if the person did not provide a value for attribute1 than attribute2 is required.
How can I do that using the model ruleS?
Use a validator method:
http://www.yiiframework.com/doc/guide/1.1/en/form.model#declaring-validation-rules
The authenticate() method on that page should give you an idea of how it works.
You can create own validations, or i saw 2 extensions with this functionality, http://www.yiiframework.com/extension/yii-conditional-validator/