1
1
.. index ::
2
2
single: Console; Events
3
3
4
- .. versionadded :: 2.3
5
- The feature described in this chapter was added in 2.3.
6
-
7
4
Using Events
8
5
============
9
6
7
+ .. versionadded :: 2.3
8
+ Console events were added in Symfony 2.3.
9
+
10
10
The Application class of the Console component allows you to optionally hook
11
11
into the lifecycle of a console application via events. Instead of reinventing
12
12
the wheel, it uses the Symfony EventDispatcher component to do the work::
@@ -18,7 +18,7 @@ the wheel, it uses the Symfony EventDispatcher component to do the work::
18
18
$application->setDispatcher($dispatcher);
19
19
$application->run();
20
20
21
- The ``ConsoleEvents::COMMAND `` event
21
+ The ``ConsoleEvents::COMMAND `` Event
22
22
------------------------------------
23
23
24
24
**Typical Purposes **: Doing something before any command is run (like logging
@@ -57,8 +57,8 @@ been executed.
57
57
58
58
After the command has been executed, the ``ConsoleEvents::TERMINATE `` event is
59
59
dispatched. It can be used to do any actions that need to be executed for all
60
- commands or to cleanup what you initiated in the ``ConsoleEvents::COMMAND ``
61
- command (like sending logs, closing a database connection, sending emails,
60
+ commands or to cleanup what you initiated in a ``ConsoleEvents::COMMAND ``
61
+ listener (like sending logs, closing a database connection, sending emails,
62
62
...). A listener might also change the exit code.
63
63
64
64
Listeners receive a
@@ -94,7 +94,7 @@ The ``ConsoleEvents::EXCEPTION`` event
94
94
command.
95
95
96
96
Whenever an exception is thrown by a command, the ``ConsoleEvents::EXCEPTION ``
97
- command is dispatched. A listener can wrap or change the exception or do
97
+ event is dispatched. A listener can wrap or change the exception or do
98
98
anything useful before the exception is thrown by the application.
99
99
100
100
Listeners receive a
0 commit comments