@@ -171,7 +171,8 @@ with the ``doctrine.event_listener`` tag:
171
171
priority : 500
172
172
173
173
# you can also restrict listeners to a specific Doctrine connection
174
- connection : ' default'
174
+ # '%doctrine_default_connection%' = 'default'
175
+ connection : ' %doctrine_default_connection%'
175
176
176
177
.. code-block :: xml
177
178
@@ -187,12 +188,13 @@ with the ``doctrine.event_listener`` tag:
187
188
* 'priority': used when multiple subscribers or listeners are associated to the same event
188
189
* (default priority = 0; higher numbers = listener is run earlier)
189
190
* 'connection': restricts the listener to a specific Doctrine connection
191
+ * '%doctrine_default_connection%' = 'default'
190
192
-->
191
193
<service id =" App\EventListener\SearchIndexer" >
192
194
<tag name =" doctrine.event_listener"
193
195
event =" postPersist"
194
196
priority =" 500"
195
- connection =" default " />
197
+ connection =" %doctrine_default_connection% " />
196
198
</service >
197
199
</services >
198
200
</container >
@@ -218,7 +220,8 @@ with the ``doctrine.event_listener`` tag:
218
220
'priority' => 500,
219
221
220
222
# you can also restrict listeners to a specific Doctrine connection
221
- 'connection' => 'default',
223
+ # '%doctrine_default_connection%' = 'default'
224
+ 'connection' => '%doctrine_default_connection%',
222
225
])
223
226
;
224
227
};
@@ -439,7 +442,8 @@ Doctrine connection to use) you must do that in the manual service configuration
439
442
priority : 500
440
443
441
444
# you can also restrict listeners to a specific Doctrine connection
442
- connection : ' default'
445
+ # '%doctrine_default_connection%' = 'default'
446
+ connection : ' %doctrine_default_connection%'
443
447
444
448
.. code-block :: xml
445
449
@@ -454,9 +458,10 @@ Doctrine connection to use) you must do that in the manual service configuration
454
458
* 'priority': used when multiple subscribers or listeners are associated to the same event
455
459
* (default priority = 0; higher numbers = listener is run earlier)
456
460
* 'connection': restricts the listener to a specific Doctrine connection
461
+ * '%doctrine_default_connection%' = 'default'
457
462
-->
458
463
<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% " />
460
465
</service >
461
466
</services >
462
467
</container >
@@ -478,7 +483,8 @@ Doctrine connection to use) you must do that in the manual service configuration
478
483
'priority' => 500,
479
484
480
485
// you can also restrict listeners to a specific Doctrine connection
481
- 'connection' => 'default',
486
+ # '%doctrine_default_connection%' = 'default'
487
+ 'connection' => '%doctrine_default_connection%',
482
488
])
483
489
;
484
490
};
@@ -487,6 +493,10 @@ Doctrine connection to use) you must do that in the manual service configuration
487
493
488
494
Subscriber priority was introduced in Symfony 5.3.
489
495
496
+ .. versionadded :: 5.4
497
+
498
+ Parameter as connection value was introduced in Symfony 5.4.
499
+
490
500
.. tip ::
491
501
492
502
Symfony loads (and instantiates) Doctrine subscribers whenever the
0 commit comments