diff --git a/guides/doctrine/mongodb-odm/configuration.rst b/guides/doctrine/mongodb-odm/configuration.rst index 3341b2c24eb..dd706703f5e 100644 --- a/guides/doctrine/mongodb-odm/configuration.rst +++ b/guides/doctrine/mongodb-odm/configuration.rst @@ -294,5 +294,13 @@ Later you can retrieve the persisted document by its id:: } } +Registering Event Listeners and Subscribers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Registering events works like described in the :ref:`ORM Bundle documentation `. +The MongoDB event tags are called "doctrine.odm.mongodb.default_event_listener" and +"doctrine.odm.mongodb.default_event_subscriber" respectively where "default" is the name of the +MongoDB document manager. + .. _MongoDB: http://www.mongodb.org/ .. _documentation: http://www.doctrine-project.org/projects/mongodb_odm/1.0/docs/en diff --git a/guides/doctrine/orm/configuration.rst b/guides/doctrine/orm/configuration.rst index 8db9b645810..334942dce54 100644 --- a/guides/doctrine/orm/configuration.rst +++ b/guides/doctrine/orm/configuration.rst @@ -147,3 +147,65 @@ retrieve it from the Symfony Dependency Injection Container:: The service "doctrine.orm.entity_manager" is an alias for the default entity manager defined in the "default_entity_manager" configuration option. + +.. _doctrine-event-config: + +Registering Event Listeners and Subscribers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Doctrine ships with an event system that allows to hook into many different +events happening during the lifecycle of entities or at other occasions. + +To register services to act as event listeners or subscribers (listeners from here) +you have to tag them with the appropriate names. Depending on your use-case you can hook +a listener into every DBAL Connection and ORM Entity Manager or just into one +specific DBAL connection and all the EntityManagers that use this connection. + +.. configuration-block:: + + .. code-block:: yaml + + doctrine.dbal: + default_connection: default + connections: + default: + driver: pdo_sqlite + memory: true + + services: + my.listener: + class: MyEventListener + tags: + - { name: doctrine.common.event_listener } + my.listener2: + class: MyEventListener2 + tags: + - { name: doctrine.dbal.default_event_listener } + my.subscriber: + class: MyEventSubscriber + tags: + - { name: doctrine.dbal.default_event_subscriber } + + .. code-block:: xml + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/guides/doctrine/orm/form.rst b/guides/doctrine/orm/form.rst index 63b7ae29167..2c424142095 100644 --- a/guides/doctrine/orm/form.rst +++ b/guides/doctrine/orm/form.rst @@ -28,7 +28,7 @@ compatible field that handles arrays of values:: 'em' => $em, 'className' => 'Product', )); - + $field = new ChoiceField('products', array( 'choices' => $productChoices, 'multiple' => true, @@ -79,4 +79,4 @@ be chosen from:: )); $form->add($engineerField); - $form->add($reporterField); + $form->add($reporterField); \ No newline at end of file pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy