From 76c4be1b7483dadd98ff5495e5cdf1337378bc65 Mon Sep 17 00:00:00 2001 From: "Fabio B. Silva" Date: Tue, 29 Jan 2013 12:19:47 -0200 Subject: [PATCH] Update docs/en/reference/events.rst Docs for lifecycle-callback event arg --- docs/en/reference/events.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/en/reference/events.rst b/docs/en/reference/events.rst index a6b75ad12..f2f112f38 100644 --- a/docs/en/reference/events.rst +++ b/docs/en/reference/events.rst @@ -336,6 +336,30 @@ The ``key`` of the lifecycleCallbacks is the name of the method and the value is the event type. The allowed event types are the ones listed in the previous Lifecycle Events section. +.. versionadded:: 2.4 +Lifecycle Callbacks Event Argument +----------------------------------- + +Since 2.4 the triggered event is given to the lifecycle-callback. + +With the additional argument you have access to the +``EntityManager`` and ``UnitOfWork`` APIs inside these callback methods. + +.. code-block:: php + + hasChangedField('username')) { + // Do something when the username is changed. + } + } + } + Listening to Lifecycle Events -----------------------------