We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

about afterSave

Hello! I have model "transactions" and related models "operations". One transactions have many operations. Now I use afterSave hook to update user balance (add operations sum to cache), but afterSave hook run on "transaction model" save. I need afterSave run after all "operations" save.

How can I do that?


Maybe to call that method you need after commit?

Doesn't putting your code after commit will do what you want? Doesn't transaction on failed save throw an exception anyway? Check this - https://docs.phalcon.io/pl/latest/reference/model-transactions.html#isolated-transactions