From d9a5c2a75193d42c4e7a9c2a786e8f6b5272cef6 Mon Sep 17 00:00:00 2001 From: Lander Vanderstraeten Date: Sat, 8 Dec 2018 15:42:32 +0100 Subject: [PATCH 1/2] Fix console error event --- components/console/events.rst | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/components/console/events.rst b/components/console/events.rst index 09bb30b2286..63e26912cce 100644 --- a/components/console/events.rst +++ b/components/console/events.rst @@ -97,13 +97,24 @@ Whenever an exception is thrown by a command, the ``ConsoleEvents::EXCEPTION`` event is dispatched. A listener can wrap or change the exception or do anything useful before the exception is thrown by the application. +The ``ConsoleEvents::ERROR`` Event +---------------------------------- + +**Typical Purposes**: Handle exceptions thrown during the execution of a +command. + +Whenever an exception is thrown by a command, including those triggered from +event listeners, the ``ConsoleEvents::ERROR`` event is dispatched. A listener +can wrap or change the exception or do anything useful before the exception is +thrown by the application. + Listeners receive a -:class:`Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent` event:: +:class:`Symfony\\Component\\Console\\Event\\ConsoleErrorEvent` event:: - use Symfony\Component\Console\Event\ConsoleExceptionEvent; + use Symfony\Component\Console\Event\ConsoleErrorEvent; use Symfony\Component\Console\ConsoleEvents; - $dispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleExceptionEvent $event) { + $dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) { $output = $event->getOutput(); $command = $event->getCommand(); @@ -114,22 +125,9 @@ Listeners receive a $exitCode = $event->getExitCode(); // changes the exception to another one - $event->setException(new \LogicException('Caught exception', $exitCode, $event->getException())); + $event->setError(new \LogicException('Caught exception', $exitCode, $event->getError())); }); -The ``ConsoleEvents::ERROR`` Event ----------------------------------- - -.. versionadded:: 3.3 - The ``ConsoleEvents::ERROR`` event was introduced in Symfony 3.3. - -**Typical Purposes**: Handle exceptions thrown during the execution of a -command. - -This event is an improved version of the ``ConsoleEvents::EXCEPTION`` event, -because it can handle every exception thrown during the execution of a command, -including those triggered from event listeners. - The ``ConsoleEvents::TERMINATE`` Event -------------------------------------- From 19462dbb0cc371ef55e61444e377b87911b9db80 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 27 Dec 2018 15:26:57 +0100 Subject: [PATCH 2/2] use .yaml instead of .yml --- form/form_collections.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/form/form_collections.rst b/form/form_collections.rst index 783dcf785f7..7c9147e81b4 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -474,7 +474,7 @@ you will learn about next!). .. code-block:: yaml - # src/Resources/config/doctrine/Task.orm.yml + # src/Resources/config/doctrine/Task.orm.yaml App\Entity\Task: type: entity # ...