Skip to content

Commit 2c16d07

Browse files
committed
Merge branch '2.8' into 3.4
* 2.8: Added a short section about registering commands Explain which branch to select for Pull Requests Missing the obvious <?php Update email field length in annotation Removed a duplicated content Clarify Symfony Console option conventions
2 parents 595b34a + d9a32c7 commit 2c16d07

File tree

5 files changed

+38
-14
lines changed

5 files changed

+38
-14
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--
2+
3+
If your pull request fixes a BUG, use the oldest maintained branch that contains
4+
the bug (see https://symfony.com/roadmap for the list of maintained branches).
5+
6+
If your pull request documents a NEW FEATURE, use the same Symfony branch where
7+
the feature was introduced (and `master` for features of unreleased versions).
8+
9+
-->

console.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,23 @@ method. Then you can optionally define a help message and the
6161
;
6262
}
6363

64+
Registering the Command
65+
-----------------------
66+
67+
Symfony commands must be registered as services and :doc:`tagged </service_container/tags>`
68+
with the ``console.command`` tag. If the PHP class of your command extends from
69+
:class:`Symfony\\Component\\Console\\Command\\Command`, Symfony does this for
70+
you automatically.
71+
6472
Executing the Command
6573
---------------------
6674

67-
Symfony registers any PHP class extending :class:`Symfony\\Component\\Console\\Command\\Command`
68-
as a console command automatically. So you can now execute this command in the
69-
terminal:
75+
After configuring and registering the command, you can execute it in the terminal:
7076

7177
.. code-block:: terminal
7278
7379
$ php bin/console app:create-user
7480
75-
.. note::
76-
77-
If you're using the :ref:`default services.yml configuration <service-container-services-load-example>`,
78-
your command classes are automatically registered as services.
79-
80-
You can also manually register your command as a service by configuring the service
81-
and :doc:`tagging it </service_container/tags>` with ``console.command``.
82-
8381
.. caution::
8482

8583
Symfony also looks in the ``Command/`` directory of bundles for commands

console/input.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ flag:
174174
1
175175
);
176176

177+
Note that to comply with the `docopt standard`_, long options can specify their
178+
values after a white space or an ``=`` sign (e.g. ``--iterations 5`` or
179+
``--iterations=5``), but short options can only use white spaces or no
180+
separation at all (e.g. ``-i 5`` or ``-i5``).
181+
177182
There are four option variants you can use:
178183

179184
``InputOption::VALUE_IS_ARRAY``
@@ -184,8 +189,8 @@ There are four option variants you can use:
184189
behavior of options;
185190

186191
``InputOption::VALUE_REQUIRED``
187-
This value is required (e.g. ``--iterations=5``), the option itself is
188-
still optional;
192+
This value is required (e.g. ``--iterations=5`` or ``-i5``), the option
193+
itself is still optional;
189194

190195
``InputOption::VALUE_OPTIONAL``
191196
This option may or may not have a value (e.g. ``--yell`` or
@@ -211,3 +216,14 @@ You can combine ``VALUE_IS_ARRAY`` with ``VALUE_REQUIRED`` or
211216
when the option was used without a value (``command --language``) or when
212217
it wasn't used at all (``command``). In both cases, the value retrieved for
213218
the option will be ``null``.
219+
220+
.. caution::
221+
222+
While it is possible to separate an option from its value with a white space,
223+
using this form leads to an ambiguity should the option appear before the
224+
command name. For example, ``php bin/console --iterations 5 app:greet Fabien``
225+
is ambiguous; Symfony would interpret ``5`` as the command name. To avoid
226+
this situation, always place options after the command name, or avoid using
227+
a space to separate the option name from its value.
228+
229+
.. _`docopt standard`: http://docopt.org/

page_creation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ random) number and prints it. To do that, create a "Controller class" and a
4444
"controller" method inside of it that will be executed when someone goes to
4545
``/lucky/number``::
4646

47+
<?php
4748
// src/AppBundle/Controller/LuckyController.php
4849
namespace AppBundle\Controller;
4950

security/entity_provider.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ For this entry, suppose that you already have a ``User`` entity inside an
7070
private $password;
7171

7272
/**
73-
* @ORM\Column(type="string", length=60, unique=true)
73+
* @ORM\Column(type="string", length=254, unique=true)
7474
*/
7575
private $email;
7676

0 commit comments

Comments
 (0)