thyseus
(Thyseus)
1
Hi,
it seems like the ActiveRecord-methods afterValidation() and beforeValidation() are broken.
Using it this way:
public function beforeValidate() {
if(parent::beforeValidate()) {
// something happens here
}
}
or even only
public function beforeValidate() { ; }
makes the Validation of my models always fail.
Setting my before-validation code in the Controller works, but i think this is not very elegant.
Or am i doing something wrong?
Thank you!
qiang
(Qiang Xue)
2
Did you forget to return true/false?
thyseus
(Thyseus)
3
Yes, of course, this solved the problem. Thank you.
Is this documented somewhere? (except in the API) 
carnage
(Send2paul)
4
Also, possibly better, make sure you are not calling the
->save()
method with the parameter set to false and you can
return parent::beforeValidate();
in your own before validate, this will make sure everything gets executed, might not fit your use-case just thought this might be useful.