From c715d91dc73c8aebf68db3ea09d01d828f5cffbb Mon Sep 17 00:00:00 2001 From: Christian Morgan Date: Thu, 1 Aug 2013 17:56:45 +0100 Subject: [PATCH] Updates based on feedback from Ocramius Addresses all comments made so far, except the one about persists/updates --- docs/en/reference/events.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/en/reference/events.rst b/docs/en/reference/events.rst index a3e2e50e4..7eccd3674 100644 --- a/docs/en/reference/events.rst +++ b/docs/en/reference/events.rst @@ -228,7 +228,8 @@ Lifecycle Callbacks Lifecycle Callbacks are defined on an entity class. They allow you to trigger callbacks whenever an instance of that entity class experiences a relevant lifecycle event. More than one callback can be defined for each -lifecycle event. +lifecycle event. Lifecycle Callbacks are best used for simple operations +specific to a particular entity class's lifecycle. .. code-block:: php @@ -278,8 +279,9 @@ lifecycle event. } } -Note that when using annotations you have to apply the -@HasLifecycleCallbacks marker annotation on the entity class. +Note that the methods set as lifecycle callbacks need to be public and, +when using these annotations, you have to apply the +``@HasLifecycleCallbacks`` marker annotation on the entity class. If you want to register lifecycle callbacks from YAML or XML you can do it with the following. @@ -297,8 +299,8 @@ can do it with the following. postPersist: [ doStuffOnPostPersist ] In YAML the ``key`` of the lifecycleCallbacks entry is the event that you -are triggering on and the values are the methods to call. The allowed event -types are the ones listed in the previous Lifecycle Events section. +are triggering on and the value is the method (or methods) to call. The allowed +event types are the ones listed in the previous Lifecycle Events section. XML would look something like this: