Important: These templates are now deprecated. You should use the corresponding events instead.
The user.workflow templates allow you to create custom routines that are triggered when an object gets created, updated or deleted. These are:
||Called on an object after it has been deleted from the store. The object is still in memory.|
||Called on an object before it will be deleted from the store.|
||Called on an object after it has been saved in the store.|
||Called on an object before it wil be saved in the store.|
Be careful when using these templates, especially the last two (workflow.post and workflow.pre). They are called whenever an object is saved, for whatever reason. This means also when you save a template. It is possible to create a logical error which is difficult to undo. In extreme cases you may have to search for the compiled template on disk and fix it by hand.
Use the ondelete event instead.
This template is called immediately after an object has been deleted from the store. The object is still available in memory, with all its data, but you can no longer
Use the onbeforedelete event instead.
This template is called immediately before an object will be deleted from the store. If you set
$this->error, the object will not be deleted. Do not attempt to delete the object from inside this template, this will generate an infinite loop.
Use the onsave event instead.
This template is called immediately after an object is saved. If you need to change the objects data, do not call
save() yourself, this will generate an infinite loop. Instead return an array of properties. This will trigger an additional save of the object, including any changes you have made. If you do not wish to add extra properties, simply return an empty array. If you return anything else, the object will remain as it is, any changes will not be saved in the store.
Use the onbeforesave event instead.
This template is called immediately before an object is saved, either as a new object or updating an existing object. If you need to know the difference, you can check the
$this->arIsNewObject variable. This will be true for new objects.
If you want to add properties for an object, you can do so here. The template gets called with the current set of properties as the
$properties argument. You can modify this array and return it. The modified properties array will get saved in the store.
Do not call
system.save.data.phtml here, since it may generate an infinite loop which prevents the object from actually getting saved.