Skip to content

Commit 7c0653a

Browse files
committed
Merge branch '2.0' into 2.1
2 parents 87b4948 + 2c39fc9 commit 7c0653a

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

book/service_container.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,29 @@ additional arguments (beyond just the ``name`` parameter).
923923
For a list of all the tags available in the core Symfony Framework, check
924924
out :doc:`/reference/dic_tags`.
925925

926+
Debugging Services
927+
------------------
928+
929+
You can find out what services are registered with the container using the
930+
console. To show all services and the class for each service, run:
931+
932+
.. code-block:: bash
933+
934+
$ php app/console container:debug
935+
936+
By default only public services are shown, but you can also view private services:
937+
938+
.. code-block:: bash
939+
940+
$ php app/console container:debug --show-private
941+
942+
You can get more detailed information about a particular service by specifying
943+
its id:
944+
945+
.. code-block:: bash
946+
947+
$ php app/console container:debug my_mailer
948+
926949
Learn more
927950
----------
928951

cookbook/console/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Console
55
:maxdepth: 2
66

77
console_command
8+
usage

cookbook/console/usage.rst

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
.. index::
2+
single: Console; Usage
3+
4+
How to use the Console
5+
======================
6+
7+
The :doc:`/components/console/usage` page of the components documentation looks
8+
at the global console options. When you use the console as part of the full
9+
stack framework, some additional global options are available as well.
10+
11+
By default, console commands run in the ``dev`` environment and you may want
12+
to change this for some commands. For example, you may want to run some commands
13+
in the ``prod`` environment for performance reasons. Also, the result of some commands
14+
will be different depending on the environment. for example, the ``cache:clear``
15+
command will clear and warm the cache for the specified environment only. To
16+
clear and warm the ``prod`` cache you need to run:
17+
18+
.. code-block:: bash
19+
20+
$ php app/console cache:clear --env=prod
21+
22+
or the equivalent:
23+
24+
.. code-block:: bash
25+
26+
$ php app/console cache:clear -e=prod
27+
28+
In addition to changing the environment, you can also choose to disable debug mode.
29+
This can be useful where you want to run commands in the ``dev`` environment
30+
but avoid the performance hit of collecting debug data:
31+
32+
.. code-block:: bash
33+
34+
$ php app/console list --no-debug
35+
36+
There is an interactive shell which allows you to enter commands without having to
37+
specify ``php app/console`` each time, which is useful if you need to run several
38+
commands. To enter the shell run:
39+
40+
.. code-block:: bash
41+
42+
$ php app/console --shell
43+
$ php app/console -s
44+
45+
You can now just run commands with the command name:
46+
47+
.. code-block:: bash
48+
49+
Symfony > list
50+
51+
When using the shell you can choose to run each command in a separate process:
52+
53+
.. code-block:: bash
54+
55+
$ php app/console --shell --process-isolation
56+
$ php app/console -s --process-isolation
57+
58+
When you do this, the output will not be colorized and interactivity is not
59+
supported so you will need to pass all command params explicitly.
60+
61+
.. note::
62+
63+
Unless you are using isolated processes, clearing the cache in the shell
64+
will not have an effect on subsequent commands you run. This is because
65+
the original cached files are still being used.

cookbook/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* **Console Commands**
2828

2929
* :doc:`/cookbook/console/console_command`
30+
* :doc:`/cookbook/console/usage`
3031

3132
* :doc:`/cookbook/controller/index`
3233

0 commit comments

Comments
 (0)