I stumbled over a problem I encountered before, but did not have the time to look into it any further. While I was using the beforeSave() hook successfully on many occasions, I failed using the beforeInsert() hook.
As I understand, the beforeSave() hook is used for both update and insert operation, while the beforeInsert() is only used when inserting a new record. Since I want to use different operations to change and add data while inserting and modifying, I tried using the beforeInsert() hook like I used the beforeSave() hook before.
I add the hook directly in my model and it is the only one used. Here is the shortened code.
$m['created']=$m->dsql()->expr('NOW()'); // save date
$m['email'] = trim(strtolower($m['email'])); // normalize emailaddress
Certainly I am just missing something, hope you can help me out.
Thanks in advance,