File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
cookbook/event_dispatcher Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -238,3 +238,16 @@ done as follow::
238
238
Two types of request are available in the :class: `Symfony\\ Component\\ HttpKernel\\ HttpKernelInterface `
239
239
interface: ``HttpKernelInterface::MASTER_REQUEST `` and
240
240
``HttpKernelInterface::SUB_REQUEST ``.
241
+
242
+ Events or Subscribers
243
+ ---------------------
244
+
245
+ Listeners and subscribers can be used in the same application indistinctly. The
246
+ decision to use either of them is usually a matter of personal taste. However,
247
+ there are some minor advantages for each of them:
248
+
249
+ * **Subscribers are easier to reuse ** because the knowledge of the events is kept
250
+ in the class rather than in the service definition. This is the reason why
251
+ Symfony uses subscribers internally;
252
+ * **Listeners are more flexible ** because bundles can enable or disable each of
253
+ them conditionally depending on some configuration value.
You can’t perform that action at this time.
0 commit comments