Skip to content

Commit 019e0ac

Browse files
committed
minor #14613 [Doctrine] Add precision for doctrine lifecycle callbacks (DuboisS)
This PR was merged into the 4.4 branch. Discussion ---------- [Doctrine] Add precision for doctrine lifecycle callbacks I think it's a good idea to specify that the methods must be public. - If the developer inadvertently makes the callable private, they will just realize that the method is not executed. No exceptions thrown. - By rereading the doc, it would be simpler for the word "public" to catch their attention. Commits ------- 6b4bee4 Update events.rst
2 parents 01a22b0 + 6b4bee4 commit 019e0ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doctrine/events.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on other common tasks (e.g. ``loadClassMetadata``, ``onClear``).
1616

1717
There are different ways to listen to these Doctrine events:
1818

19-
* **Lifecycle callbacks**, they are defined as methods on the entity classes and
19+
* **Lifecycle callbacks**, they are defined as public methods on the entity classes and
2020
they are called when the events are triggered;
2121
* **Lifecycle listeners and subscribers**, they are classes with callback
2222
methods for one or more events and they are called for all entities;
@@ -46,7 +46,7 @@ to learn everything about them.
4646
Doctrine Lifecycle Callbacks
4747
----------------------------
4848

49-
Lifecycle callbacks are defined as methods inside the entity you want to modify.
49+
Lifecycle callbacks are defined as public methods inside the entity you want to modify.
5050
For example, suppose you want to set a ``createdAt`` date column to the current
5151
date, but only when the entity is first persisted (i.e. inserted). To do so,
5252
define a callback for the ``prePersist`` Doctrine event:

0 commit comments

Comments
 (0)