Forums / Developer / detect new object creation.. / Comment65014
Marko Žmak
Wednesday 12 January 2011 6:40:56 am
Bertrand, thanks for the info and arguments. Here are some of my points...
Execution order
content edit handlers are executed at step #9 of the content/publish operation (out of 19 currently). Several further steps haven't been executed yet at that step. Post publish trigger is step #19. The object is therefore in an incomplete state (onPublish hasn't been called on attributes, untranslated attributes haven't been updated, cache hasn't been cleared, search indexing hasn't been done...). This might not be an issue in every case, but it can't be neglected.
There are some cases when you DO want to execute some code before all this operations. Here's an example from my real life experience... If you need this functionality:
Then you want to do the 1) before the cache is cleared and search indexing is done, and you want to do 2) before onPublish is called.
It isn't a technical argument, but imho, a workflow makes more sense (yet, that isn't very concrete) than a content edit handler here, in terms of extension type.
So what would in your opinion be the scenario when a content edit handler is a better choice? I'd love to hear some examples.
To sum it up, it actually comes up to what Bertrand suggested:
You really have to know precisely what you want to do before you can decide between content edit handler and workflow.
-- Nothing is impossible. Not if you can imagine it! Hubert Farnsworth