Skip to content

Commit 276a0f5

Browse files
Removing paragraph on consts (#9158)
IMO, this is better shown by example, so I added it there.
1 parent 641330b commit 276a0f5

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

docs/en/reference/events.rst

+6-11
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,6 @@ events during the life-time of their registered entities.
254254
cascade remove relations. In this case, you should load yourself the proxy in
255255
the associated pre event.
256256

257-
You can access the Event constants from the ``Events`` class in the
258-
ORM package.
259-
260-
.. code-block:: php
261-
262-
<?php
263-
use Doctrine\ORM\Events;
264-
echo Events::preUpdate;
265-
266257
These can be hooked into by two different types of event
267258
listeners:
268259

@@ -531,8 +522,10 @@ EventManager that is passed to the EntityManager factory:
531522
.. code-block:: php
532523
533524
<?php
525+
use Doctrine\ORM\Events;
526+
534527
$eventManager = new EventManager();
535-
$eventManager->addEventListener(array(Events::preUpdate), new MyEventListener());
528+
$eventManager->addEventListener([Events::preUpdate], new MyEventListener());
536529
$eventManager->addEventSubscriber(new MyEventSubscriber());
537530
538531
$entityManager = EntityManager::create($dbOpts, $config, $eventManager);
@@ -543,7 +536,9 @@ EntityManager was created:
543536
.. code-block:: php
544537
545538
<?php
546-
$entityManager->getEventManager()->addEventListener(array(Events::preUpdate), new MyEventListener());
539+
use Doctrine\ORM\Events;
540+
541+
$entityManager->getEventManager()->addEventListener([Events::preUpdate], new MyEventListener());
547542
$entityManager->getEventManager()->addEventSubscriber(new MyEventSubscriber());
548543
549544
.. _reference-events-implementing-listeners:

0 commit comments

Comments
 (0)