Skip to content

Commit 05437d3

Browse files
committed
Reword
1 parent 97bb699 commit 05437d3

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

doctrine/events.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ with the ``doctrine.event_listener`` tag:
171171
priority: 500
172172
173173
# you can also restrict listeners to a specific Doctrine connection
174-
# '%doctrine_default_connection%' = 'default'
175-
connection: '%doctrine_default_connection%'
174+
connection: 'default'
176175
177176
.. code-block:: xml
178177
@@ -188,13 +187,12 @@ with the ``doctrine.event_listener`` tag:
188187
* 'priority': used when multiple subscribers or listeners are associated to the same event
189188
* (default priority = 0; higher numbers = listener is run earlier)
190189
* 'connection': restricts the listener to a specific Doctrine connection
191-
* '%doctrine_default_connection%' = 'default'
192190
-->
193191
<service id="App\EventListener\SearchIndexer">
194192
<tag name="doctrine.event_listener"
195193
event="postPersist"
196194
priority="500"
197-
connection="%doctrine_default_connection%"/>
195+
connection="default"/>
198196
</service>
199197
</services>
200198
</container>
@@ -220,8 +218,7 @@ with the ``doctrine.event_listener`` tag:
220218
'priority' => 500,
221219
222220
# you can also restrict listeners to a specific Doctrine connection
223-
# '%doctrine_default_connection%' = 'default'
224-
'connection' => '%doctrine_default_connection%',
221+
'connection' => 'default',
225222
])
226223
;
227224
};
@@ -232,6 +229,16 @@ with the ``doctrine.event_listener`` tag:
232229
Doctrine event is actually fired; whereas Doctrine subscribers are always
233230
loaded (and instantiated) by Symfony, making them less performant.
234231

232+
.. tip::
233+
234+
The value of the ``connection`` option can also be a
235+
:ref:`configuration parameter <configuration-parameters>`.
236+
237+
.. versionadded:: 5.4
238+
239+
The feature to allow using configuration parameters in ``connection``
240+
was introduced in Symfony 5.4.
241+
235242
Doctrine Entity Listeners
236243
-------------------------
237244

@@ -442,8 +449,7 @@ Doctrine connection to use) you must do that in the manual service configuration
442449
priority: 500
443450
444451
# you can also restrict listeners to a specific Doctrine connection
445-
# '%doctrine_default_connection%' = 'default'
446-
connection: '%doctrine_default_connection%'
452+
connection: 'default'
447453
448454
.. code-block:: xml
449455
@@ -458,10 +464,9 @@ Doctrine connection to use) you must do that in the manual service configuration
458464
* 'priority': used when multiple subscribers or listeners are associated to the same event
459465
* (default priority = 0; higher numbers = listener is run earlier)
460466
* 'connection': restricts the listener to a specific Doctrine connection
461-
* '%doctrine_default_connection%' = 'default'
462467
-->
463468
<service id="App\EventListener\DatabaseActivitySubscriber">
464-
<tag name="doctrine.event_subscriber" priority="500" connection="%doctrine_default_connection%"/>
469+
<tag name="doctrine.event_subscriber" priority="500" connection="default"/>
465470
</service>
466471
</services>
467472
</container>
@@ -483,8 +488,7 @@ Doctrine connection to use) you must do that in the manual service configuration
483488
'priority' => 500,
484489
485490
// you can also restrict listeners to a specific Doctrine connection
486-
# '%doctrine_default_connection%' = 'default'
487-
'connection' => '%doctrine_default_connection%',
491+
'connection' => 'default',
488492
])
489493
;
490494
};
@@ -493,10 +497,6 @@ Doctrine connection to use) you must do that in the manual service configuration
493497

494498
Subscriber priority was introduced in Symfony 5.3.
495499

496-
.. versionadded:: 5.4
497-
498-
Parameter as connection value was introduced in Symfony 5.4.
499-
500500
.. tip::
501501

502502
Symfony loads (and instantiates) Doctrine subscribers whenever the

0 commit comments

Comments
 (0)