diff --git a/_build/redirection_map b/_build/redirection_map
index 146e731e460..a60b33f051f 100644
--- a/_build/redirection_map
+++ b/_build/redirection_map
@@ -346,6 +346,7 @@
/components/var_dumper/index /components/var_dumper
/components/yaml/introduction /components/yaml
/components/yaml/index /components/yaml
+/console/logging /console
/deployment/tools /deployment
/install/bundles /setup/bundles
/event_dispatcher/class_extension /event_dispatcher
diff --git a/console.rst b/console.rst
index dfa559991f8..3ec442a8e1c 100644
--- a/console.rst
+++ b/console.rst
@@ -163,11 +163,11 @@ Getting Services from the Service Container
To actually create a new user, the command has to access to some
:doc:`services `. Since your command is already registered
as a service, you can use normal dependency injection. Imagine you have a
-``AppBundle\Service\UserManager`` service that you want to access::
+``App\Service\UserManager`` service that you want to access::
// ...
use Symfony\Component\Console\Command\Command;
- use AppBundle\Service\UserManager;
+ use App\Service\UserManager;
class CreateUserCommand extends Command
{
diff --git a/console/calling_commands.rst b/console/calling_commands.rst
index 78759b70947..cfa3adf9966 100644
--- a/console/calling_commands.rst
+++ b/console/calling_commands.rst
@@ -6,7 +6,7 @@ user to remember the order of execution, you can call it directly yourself.
This is also useful if you want to create a "meta" command that just runs a
bunch of other commands (for instance, all commands that need to be run when
the project's code has changed on the production servers: clearing the cache,
-generating Doctrine2 proxies, dumping Assetic assets, ...).
+generating Doctrine2 proxies, dumping web assets, ...).
Calling a command from another one is straightforward::
diff --git a/console/coloring.rst b/console/coloring.rst
index 0df7b4dd197..7594e439e9f 100644
--- a/console/coloring.rst
+++ b/console/coloring.rst
@@ -43,7 +43,7 @@ It is possible to define your own styles using the
$style = new OutputFormatterStyle('red', 'yellow', array('bold', 'blink'));
$output->getFormatter()->setStyle('fire', $style);
- $output->writeln('foo');
+ $output->writeln('foo>');
Available foreground and background colors are: ``black``, ``red``, ``green``,
``yellow``, ``blue``, ``magenta``, ``cyan`` and ``white``.
@@ -54,7 +54,7 @@ are swapped) and ``conceal`` (sets the foreground color to transparent, making
the typed text invisible - although it can be selected and copied; this option is
commonly used when asking the user to type sensitive information).
-You can also set these colors and options directly inside the tagname::
+You can also set these colors and options directly inside the tag name::
// green text
$output->writeln('foo>');
diff --git a/console/commands_as_services.rst b/console/commands_as_services.rst
index 217698bced8..d319b2172df 100644
--- a/console/commands_as_services.rst
+++ b/console/commands_as_services.rst
@@ -86,8 +86,8 @@ Or set the ``command`` attribute on the ``console.command`` tag in your service
.. code-block:: yaml
+ # config/services.yaml
services:
-
App\Command\SunshineCommand:
tags:
- { name: 'console.command', command: 'app:sunshine' }
@@ -95,24 +95,23 @@ Or set the ``command`` attribute on the ``console.command`` tag in your service
.. code-block:: xml
+
-
-
.. code-block:: php
+ // config/services.php
use App\Command\SunshineCommand;
-
//...
$container
diff --git a/console/lockable_trait.rst b/console/lockable_trait.rst
index 18b64e57373..ce9cac0bbd8 100644
--- a/console/lockable_trait.rst
+++ b/console/lockable_trait.rst
@@ -2,9 +2,8 @@ Prevent Multiple Executions of a Console Command
================================================
A simple but effective way to prevent multiple executions of the same command in
-a single server is to use **file locks**. The Filesystem component provides a
-:doc:`LockHandler ` class that eases the
-creation and release of these locks.
+a single server is to use **file locks**. The Lock component eases the creation
+and release of these locks.
In addition, the Console component provides a PHP trait called ``LockableTrait``
that adds two convenient methods to lock and release commands::
diff --git a/console/logging.rst b/console/logging.rst
deleted file mode 100644
index 000165112b0..00000000000
--- a/console/logging.rst
+++ /dev/null
@@ -1,15 +0,0 @@
-.. index::
- single: Console; Enabling logging
-
-How to Enable Logging in Console Commands
-=========================================
-
-In Symfony versions prior to 3.3, the Console component didn't provide any
-logging capabilities out of the box and you had to implement your own exception
-listener for the console.
-
-Starting from Symfony 3.3, the Console component provides automatic error and
-exception logging.
-
-You can of course also access and use the :doc:`logger ` service to
-log messages.
diff --git a/console/request_context.rst b/console/request_context.rst
index 11125b58255..7f4cbd2540a 100644
--- a/console/request_context.rst
+++ b/console/request_context.rst
@@ -21,8 +21,8 @@ Configuring the Request Context Globally
To configure the Request Context - which is used by the URL Generator - you can
redefine the parameters it uses as default values to change the default host
-(localhost) and scheme (http). You can also configure the base path if Symfony
-is not running in the root directory.
+(``localhost``) and scheme (``http``). You can also configure the base path if
+Symfony is not running in the root directory.
Note that this does not impact URLs generated via normal web requests, since those
will override the defaults.
@@ -31,7 +31,7 @@ will override the defaults.
.. code-block:: yaml
- # app/config/parameters.yml
+ # config/services.yaml
parameters:
router.request_context.host: example.org
router.request_context.scheme: https
@@ -39,7 +39,7 @@ will override the defaults.
.. code-block:: xml
-
+
@@ -54,7 +54,7 @@ will override the defaults.
.. code-block:: php
- // app/config/parameters.php
+ // config/services.php
$container->setParameter('router.request_context.host', 'example.org');
$container->setParameter('router.request_context.scheme', 'https');
$container->setParameter('router.request_context.base_url', 'my/path');
@@ -62,21 +62,29 @@ will override the defaults.
Configuring the Request Context per Command
-------------------------------------------
-To change it only in one command you can simply fetch the Request Context
-from the ``router`` service and override its settings::
+To change it only in one command you can fetch the Request Context from the
+router service and override its settings::
- // src/Command/DemoCommand.php
+ // src/Command/DemoCommand.php
+ use Symfony\Component\Routing\RouterInterface;
+ // ...
- // ...
- class DemoCommand extends ContainerAwareCommand
- {
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $context = $this->getContainer()->get('router')->getContext();
- $context->setHost('example.com');
- $context->setScheme('https');
- $context->setBaseUrl('my/path');
+ class DemoCommand extends ContainerAwareCommand
+ {
+ private $router;
- // ... your code here
- }
- }
+ public function __construct(RouterInterface $router)
+ {
+ $this->router = $router;
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $context = $this->router->getContext();
+ $context->setHost('example.com');
+ $context->setScheme('https');
+ $context->setBaseUrl('my/path');
+
+ // ... your code here
+ }
+ }
diff --git a/console/usage.rst b/console/usage.rst
index 38b745b1276..3575737dd3b 100644
--- a/console/usage.rst
+++ b/console/usage.rst
@@ -8,24 +8,13 @@ The :doc:`/components/console/usage` page of the components documentation looks
at the global console options. When you use the console as part of the full-stack
framework, some additional global options are available as well.
-By default, console commands run in the ``dev`` environment and you may want to
-change this for some commands. For example, you may want to run some commands in
-the ``prod`` environment for performance reasons. Also, the result of some
-commands will be different depending on the environment. For example, the
-``cache:clear`` command will clear the cache for the specified environment only.
-To clear the ``prod`` cache you need to run:
-
-.. code-block:: terminal
-
- $ php bin/console cache:clear --no-warmup --env=prod
-
- # this is equivalent:
- $ php bin/console cache:clear --no-warmup -e prod
-
-In addition to changing the environment, you can also choose to disable debug mode.
-This can be useful where you want to run commands in the ``dev`` environment
-but avoid the performance hit of collecting debug data:
-
-.. code-block:: terminal
-
- $ php bin/console list --no-debug
+Console commands run in the environment defined in the ``APP_ENV`` variable of
+the ``.env`` file, which is ``dev`` by default. The result of some commands will
+be different depending on the environment (e.g. the ``cache:clear`` command
+clears the cache for the given environment only). To run the command in other
+environment, edit the value of ``APP_ENV``.
+
+In addition to changing the environment, you can also choose to disable debug
+mode. This can be useful where you want to run commands in the ``dev``
+environment but avoid the performance hit of collecting debug data. To do that,
+set the value of the ``APP_DEBUG`` env var to ``0`` in the same ``.env`` file.
diff --git a/console/verbosity.rst b/console/verbosity.rst
index 609d60bc003..7776f9a513f 100644
--- a/console/verbosity.rst
+++ b/console/verbosity.rst
@@ -63,13 +63,6 @@ verbosity levels::
// ...
}
-.. note::
-
- These semantic methods are defined in the ``OutputInterface`` starting from
- Symfony 3.0. In previous Symfony versions they are defined in the different
- implementations of the interface (e.g. :class:`Symfony\\Component\\Console\\Output\\Output`)
- in order to keep backward compatibility.
-
When the quiet level is used, all output is suppressed as the default
:method:`Symfony\\Component\\Console\\Output\\Output::write` method returns
without actually printing.