while debugging I figured out some really strange behavior and I can’t explain to myself, why Yii is acting like that.
I have a model which wants to be saved to the database. For this I have a "beforeSafe" function, to add a timestamp (which is required).
If I let it run now, the process doesn’t go into the beforeSave funtion, he just quits with an error, because a required field (timestamp) is missing.
If I now set the timestamp BEFORE I call the
$model->save();
, the process runs into the beforeSave function …
I’m just wondering why Yii behaves like that? I’ve no idea so far … or does Yii the validation of the fields before he runs into the “beforeSave” function? --> so there is no way, to set required fields in a beforeSave function? … I’m a bit confused here O_o