I am currently working in yii, I have designed a user module which consists user registraion, user login & change password rule.
for these three process I have designed only one model i.e. user model. in this model I have defined a rule:
array('email, password, bus_name, bus_type', 'required'),
This rule is valid for actionRegister. but now I want to define a new required rule for actionChangePassword,
array('password, conf_password', 'required'),
How can I define rule for this action ?
Rules can be associated with scenarios. A certain rule will only be used if the model’s current
scenarioproperty says it should.Sample model code:
Sample controller code: