@@ -171,7 +171,8 @@ with the ``doctrine.event_listener`` tag:
171171 priority : 500
172172
173173 # you can also restrict listeners to a specific Doctrine connection
174- connection : ' default'
174+ # '%doctrine_default_connection%' = 'default'
175+ connection : ' %doctrine_default_connection%'
175176
176177 .. code-block :: xml
177178
@@ -187,12 +188,13 @@ with the ``doctrine.event_listener`` tag:
187188 * 'priority': used when multiple subscribers or listeners are associated to the same event
188189 * (default priority = 0; higher numbers = listener is run earlier)
189190 * 'connection': restricts the listener to a specific Doctrine connection
191+ * '%doctrine_default_connection%' = 'default'
190192 -->
191193 <service id =" App\EventListener\SearchIndexer" >
192194 <tag name =" doctrine.event_listener"
193195 event =" postPersist"
194196 priority =" 500"
195- connection =" default " />
197+ connection =" %doctrine_default_connection% " />
196198 </service >
197199 </services >
198200 </container >
@@ -218,7 +220,8 @@ with the ``doctrine.event_listener`` tag:
218220 'priority' => 500,
219221
220222 # you can also restrict listeners to a specific Doctrine connection
221- 'connection' => 'default',
223+ # '%doctrine_default_connection%' = 'default'
224+ 'connection' => '%doctrine_default_connection%',
222225 ])
223226 ;
224227 };
@@ -439,7 +442,8 @@ Doctrine connection to use) you must do that in the manual service configuration
439442 priority : 500
440443
441444 # you can also restrict listeners to a specific Doctrine connection
442- connection : ' default'
445+ # '%doctrine_default_connection%' = 'default'
446+ connection : ' %doctrine_default_connection%'
443447
444448 .. code-block :: xml
445449
@@ -454,9 +458,10 @@ Doctrine connection to use) you must do that in the manual service configuration
454458 * 'priority': used when multiple subscribers or listeners are associated to the same event
455459 * (default priority = 0; higher numbers = listener is run earlier)
456460 * 'connection': restricts the listener to a specific Doctrine connection
461+ * '%doctrine_default_connection%' = 'default'
457462 -->
458463 <service id =" App\EventListener\DatabaseActivitySubscriber" >
459- <tag name =" doctrine.event_subscriber" priority =" 500" connection =" default " />
464+ <tag name =" doctrine.event_subscriber" priority =" 500" connection =" %doctrine_default_connection% " />
460465 </service >
461466 </services >
462467 </container >
@@ -478,7 +483,8 @@ Doctrine connection to use) you must do that in the manual service configuration
478483 'priority' => 500,
479484
480485 // you can also restrict listeners to a specific Doctrine connection
481- 'connection' => 'default',
486+ # '%doctrine_default_connection%' = 'default'
487+ 'connection' => '%doctrine_default_connection%',
482488 ])
483489 ;
484490 };
@@ -487,6 +493,10 @@ Doctrine connection to use) you must do that in the manual service configuration
487493
488494 Subscriber priority was introduced in Symfony 5.3.
489495
496+ .. versionadded :: 5.4
497+
498+ Parameter as connection value was introduced in Symfony 5.4.
499+
490500.. tip ::
491501
492502 Symfony loads (and instantiates) Doctrine subscribers whenever the
0 commit comments