Validating a scenario in 2 ways? [SOLVED]

Hello. I wonder what is the difference if we validate a model in follow two ways:


$model = new User('scenarioName');

//and then....

$model->validate()



or the second manner:


$model = new User();

//and then....

$model->validate('scenarioName');

What are the differences?

Thanks.

I hope I don’t answer any stupid question.

Your second example is wrong. validate() expects attributes, not a scenario.

Then this example is wrong?

http://php-thoughts.cubedwater.com/2009/validation-scenarios/

It’s correct as of 1.0.x

http://www.yiiframework.com/doc/api/1.0.12/CModel#validate-detail

The syntax was changed in 1.1

http://www.yiiframework.com/doc/api/CModel#validate-detail

/Tommy