Repository navigation
Adding check for hooks that should run - #352
dougblackjr wants to merge 2 commits into
Conversation
|
I feel like adding a global change like this could have adverse side effects. If the issue is that updateEntryStats is calling |
|
@litzinger That was my concern as well. My only concern with adding it to the |
|
Well, regardless of where it is added, I feel like setting the extra property on the class is safer, b/c it would default to false and require a very explicit call to prevent forwarding to the hooks. |
|
Closing in favor of #386 |
Overview
This addresses #248, where the
after_channel_entry_saveextension hook would run twice when saving a new channel entry.Resolves #248 .
Nature of This Change
Is this backwards compatible?
Documentation
From what I see, this hook was firing twice due to the
savefunction inEllisLab\ExpressionEngine\Service\Model\Model.php. Thesavefunction fires the hook immediately upon invoking this function. When creating a new channel entry, theinsertmethod is called on the facade. It appears that, when this happens, it runs throughupdateEntryStatsin ChannelEntry.php, which then reruns the save function above, but this time updates the entry. The save hooks are being called twice.The check I added checks against the specific object that is created to see if it is processed; if the save hook has already run, it won't run it again.
I'm not entirely sure this is the most elegant solution, so I gladly welcome any feedback.