renathy
(Renate Vidruska)
October 7, 2011, 10:10am
1
I have a lot of validation rules in my model, however, I have a case when I do not need any validation except validate one attribute. Can i to this?
Something like:
$valid = $model->save(‘validate only one attribute “attribute” to be a valid double value’);
Each
(Rikius)
October 7, 2011, 10:12am
2
renathy:
I have a lot of validation rules in my model, however, I have a case when I do not need any validation except validate one attribute. Can i to this?
Something like:
$valid = $model->save(‘validate only one attribute “attribute” to be a valid double value’);
make scenario for that attribute, then in your controller make
$model->setScenario("validate_one_param");
RusAlex
(Pletnev Rusalex)
October 7, 2011, 10:18am
3
You can use next construction:
if($model->validate(array('attribute')) { // will validate only one attribute
$model->save(false); //will save a model without running validation process
}