This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
According to the documentation:
If a model already existed in the database and the save method is called, the beforeUpdate / afterUpdate events will fire.
But if I try something like this:
class Foo extends Model {
public function beforeUpdate()
{
// do stuff
}
}
it turns out that the code within beforeUpdate() is ignored.
What did I do wrong ?
Did you try:
trace_log("beforeUpdate was called");
in your beforeUpdate to see if it gets called?
You're right, beforeSave() gets called but not beforeUpdate()...
odd, I'm sure I've used this before. Let me investigate further.
Something is preventing it from being called on SOME of my models and not others... I keep digging.
Ok, so it turns out this will not get called if no changes were made to your model (which makes sense).
So it's working fine.
1-7 of 7