@@ -5,13 +5,15 @@ How to Make Commands Lazily Loaded
5
5
Support for command lazy loading was introduced in Symfony 3.4.
6
6
7
7
.. note ::
8
+
8
9
If you are using the Symfony full-stack framework, you are probably looking for
9
10
:ref: `lazy loading of commands defined as services <console-command-service-lazy-loading >`
10
11
11
12
The traditional way of adding commands to your application is to use
12
13
:method: `Symfony\\ Component\\ Console\\ Application::add ` which expects a
13
14
``Command `` instance as argument.
14
- In order to get commands loaded lazily, you need to register an intermediate router
15
+
16
+ In order to lazy load commands, you need to register an intermediate loader
15
17
which will be responsible for returning ``Command `` instances::
16
18
17
19
use AppBundle\Command\HeavyCommand;
@@ -34,7 +36,7 @@ This example makes use of the built-in
34
36
but the :method: `Symfony\\ Component\\ Console\\ Application::setCommandLoader `
35
37
method accepts any
36
38
:class: `Symfony\\ Component\\ Console\\ CommandLoader\\ CommandLoaderInterface `
37
- instance so you can easily create and use your own implementation.
39
+ instance so you can use your own implementation.
38
40
39
41
Built-in Command Loaders
40
42
------------------------
@@ -61,9 +63,9 @@ is called.
61
63
~~~~~~~~~~~~~~~~~~~~~~~~~~
62
64
63
65
The :class: `Symfony\\ Component\\ Console\\ CommandLoader\\ ContainerCommandLoader `
64
- class can be used to load commands from a PSR-11 container.
65
- As such, its constructor takes a PSR-11 ``ContainerInterface `` implementation as
66
- first argument and a command map as last argument. The command map must be an array
66
+ class can be used to load commands from a PSR-11 container. As such, its
67
+ constructor takes a PSR-11 ``ContainerInterface `` implementation as first
68
+ argument and a command map as last argument. The command map must be an array
67
69
with command names as keys and service identifiers as values::
68
70
69
71
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
0 commit comments