From 9492d50c26bb9a2b278afa0ae637bd3a8ae5222e Mon Sep 17 00:00:00 2001 From: Denis Dudarev Date: Mon, 11 Jun 2018 15:53:58 +0300 Subject: [PATCH 1/4] Observer instead of Mediator pattern Actually EventDespacher component implements Observer pattern (GoF) but not a Mediator. I think we should change this description so as not to confuse users in the future. --- components/event_dispatcher.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/event_dispatcher.rst b/components/event_dispatcher.rst index 8f97727f737..31a4bac4d65 100644 --- a/components/event_dispatcher.rst +++ b/components/event_dispatcher.rst @@ -25,7 +25,7 @@ before or after a method is executed, without interfering with other plugins. This is not an easy problem to solve with single inheritance, and even if multiple inheritance was possible with PHP, it comes with its own drawbacks. -The Symfony EventDispatcher component implements the `Mediator`_ pattern +The Symfony EventDispatcher component implements the `Observer`_ pattern in a simple and effective way to make all these things possible and to make your projects truly extensible. From 8536c64ae802d8d18c3f85d940817f120dc21c5f Mon Sep 17 00:00:00 2001 From: Denis Dudarev Date: Mon, 11 Jun 2018 16:32:30 +0300 Subject: [PATCH 2/4] Update event_dispatcher.rst --- components/event_dispatcher.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/event_dispatcher.rst b/components/event_dispatcher.rst index 31a4bac4d65..149a0e6a14f 100644 --- a/components/event_dispatcher.rst +++ b/components/event_dispatcher.rst @@ -25,7 +25,7 @@ before or after a method is executed, without interfering with other plugins. This is not an easy problem to solve with single inheritance, and even if multiple inheritance was possible with PHP, it comes with its own drawbacks. -The Symfony EventDispatcher component implements the `Observer`_ pattern +The Symfony EventDispatcher component implements the `Observer` pattern in a simple and effective way to make all these things possible and to make your projects truly extensible. @@ -516,7 +516,7 @@ Learn More * :ref:`The kernel.event_listener tag ` * :ref:`The kernel.event_subscriber tag ` -.. _Mediator: https://en.wikipedia.org/wiki/Mediator_pattern +.. _Observer: https://en.wikipedia.org/wiki/Observer_pattern .. _Closures: https://php.net/manual/en/functions.anonymous.php .. _PHP callable: https://php.net/manual/en/language.pseudo-types.php#language.types.callback .. _Packagist: https://packagist.org/packages/symfony/event-dispatcher From 6c94ac81a293cdcf3e11730f1c8d59494bb54416 Mon Sep 17 00:00:00 2001 From: Denis Dudarev Date: Mon, 11 Jun 2018 16:33:08 +0300 Subject: [PATCH 3/4] Update event_dispatcher.rst --- components/event_dispatcher.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/event_dispatcher.rst b/components/event_dispatcher.rst index 149a0e6a14f..348e796f30b 100644 --- a/components/event_dispatcher.rst +++ b/components/event_dispatcher.rst @@ -25,7 +25,7 @@ before or after a method is executed, without interfering with other plugins. This is not an easy problem to solve with single inheritance, and even if multiple inheritance was possible with PHP, it comes with its own drawbacks. -The Symfony EventDispatcher component implements the `Observer` pattern +The Symfony EventDispatcher component implements the `Observer`_ pattern in a simple and effective way to make all these things possible and to make your projects truly extensible. From a844c4df4d8ae945137c7622376258c1c7a1162a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 25 Jun 2018 17:43:58 +0200 Subject: [PATCH 4/4] Mention that the component implements both patterns --- components/event_dispatcher.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/event_dispatcher.rst b/components/event_dispatcher.rst index 348e796f30b..5bb23f0c2d2 100644 --- a/components/event_dispatcher.rst +++ b/components/event_dispatcher.rst @@ -25,9 +25,9 @@ before or after a method is executed, without interfering with other plugins. This is not an easy problem to solve with single inheritance, and even if multiple inheritance was possible with PHP, it comes with its own drawbacks. -The Symfony EventDispatcher component implements the `Observer`_ pattern -in a simple and effective way to make all these things possible and to make -your projects truly extensible. +The Symfony EventDispatcher component implements the `Mediator`_ and `Observer`_ +design patterns to make all these things possible and to make your projects +truly extensible. Take a simple example from :doc:`the HttpKernel component `. Once a ``Response`` object has been created, it may be useful to allow other @@ -516,6 +516,7 @@ Learn More * :ref:`The kernel.event_listener tag ` * :ref:`The kernel.event_subscriber tag ` +.. _Mediator: https://en.wikipedia.org/wiki/Mediator_pattern .. _Observer: https://en.wikipedia.org/wiki/Observer_pattern .. _Closures: https://php.net/manual/en/functions.anonymous.php .. _PHP callable: https://php.net/manual/en/language.pseudo-types.php#language.types.callback