Hi,
I’ve been working on a Yii project for the last 6 months, and for much of this time, if I wanted to manipulate data before saving it into the model, I’d use the beforeSave method then return parent::beforeSave.
I was recently looking at some of my old code that changes the jquery date picker into a mySql date format before inserting into the database and realized that it might be better to go in the beforeValidate method.
$this->date_appointment = DateConvert::ToMySql($this->date_appointment) where ToMySql returns null if it’s not a real date. That way, it will fail on the required Rule during validate.
Does this seem reasonable? Or is there a more intuitive way than this?
Thanks, Bryan
BTW, anyone know if calling parent::beforeValidate is necessary?