@@ -171,8 +171,7 @@ 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
- # '%doctrine_default_connection%' = 'default'
175
- connection : ' %doctrine_default_connection%'
174
+ connection : ' default'
176
175
177
176
.. code-block :: xml
178
177
@@ -188,13 +187,12 @@ with the ``doctrine.event_listener`` tag:
188
187
* 'priority': used when multiple subscribers or listeners are associated to the same event
189
188
* (default priority = 0; higher numbers = listener is run earlier)
190
189
* 'connection': restricts the listener to a specific Doctrine connection
191
- * '%doctrine_default_connection%' = 'default'
192
190
-->
193
191
<service id =" App\EventListener\SearchIndexer" >
194
192
<tag name =" doctrine.event_listener"
195
193
event =" postPersist"
196
194
priority =" 500"
197
- connection =" %doctrine_default_connection% " />
195
+ connection =" default " />
198
196
</service >
199
197
</services >
200
198
</container >
@@ -220,8 +218,7 @@ with the ``doctrine.event_listener`` tag:
220
218
'priority' => 500,
221
219
222
220
# you can also restrict listeners to a specific Doctrine connection
223
- # '%doctrine_default_connection%' = 'default'
224
- 'connection' => '%doctrine_default_connection%',
221
+ 'connection' => 'default',
225
222
])
226
223
;
227
224
};
@@ -232,6 +229,16 @@ with the ``doctrine.event_listener`` tag:
232
229
Doctrine event is actually fired; whereas Doctrine subscribers are always
233
230
loaded (and instantiated) by Symfony, making them less performant.
234
231
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
+
235
242
Doctrine Entity Listeners
236
243
-------------------------
237
244
@@ -442,8 +449,7 @@ Doctrine connection to use) you must do that in the manual service configuration
442
449
priority : 500
443
450
444
451
# you can also restrict listeners to a specific Doctrine connection
445
- # '%doctrine_default_connection%' = 'default'
446
- connection : ' %doctrine_default_connection%'
452
+ connection : ' default'
447
453
448
454
.. code-block :: xml
449
455
@@ -458,10 +464,9 @@ Doctrine connection to use) you must do that in the manual service configuration
458
464
* 'priority': used when multiple subscribers or listeners are associated to the same event
459
465
* (default priority = 0; higher numbers = listener is run earlier)
460
466
* 'connection': restricts the listener to a specific Doctrine connection
461
- * '%doctrine_default_connection%' = 'default'
462
467
-->
463
468
<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 " />
465
470
</service >
466
471
</services >
467
472
</container >
@@ -483,8 +488,7 @@ Doctrine connection to use) you must do that in the manual service configuration
483
488
'priority' => 500,
484
489
485
490
// you can also restrict listeners to a specific Doctrine connection
486
- # '%doctrine_default_connection%' = 'default'
487
- 'connection' => '%doctrine_default_connection%',
491
+ 'connection' => 'default',
488
492
])
489
493
;
490
494
};
@@ -493,10 +497,6 @@ Doctrine connection to use) you must do that in the manual service configuration
493
497
494
498
Subscriber priority was introduced in Symfony 5.3.
495
499
496
- .. versionadded :: 5.4
497
-
498
- Parameter as connection value was introduced in Symfony 5.4.
499
-
500
500
.. tip ::
501
501
502
502
Symfony loads (and instantiates) Doctrine subscribers whenever the
0 commit comments