Little confused between on_after_post() & on_before_save()

edited December 2010 in Share
Hello,

I am little confused between on_after_post() method and on_before_save() method..

When I fill the form and do submit then it will fire first "on_before_save()" and I can get all form values
and then later it will go to "on_after_post()" and in on_after_post() I am also getting all values..

So I want to confirm that first it is storing the data in DB via "on_before_save()" and later it is calling "on_after_post()" ?

Actually function name makes me confused.. Because once we click on submit button then first should be call "on_after_post()" and later it should be call "on_before_save()" ( I think this order is correct? )

Comments

  • edited 2:30PM
    That is correct. I can see how the names can be confusing. To confuse you more, there's an on_before_post hook too, which get's called before any saving or validating. It may help to look at the code where it is implemented. The on_after_post method is called on the fuel/modules/fuel/controller/module.php file on lines 489 and on 985 when creating/editing a module. All the other hooks are actually called within the model. That hook was explicitly created to allow for things like image processing after saving.
Sign In or Register to comment.