Skip to content

Commit d9a32c7

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: 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 a02187f + f0469d3 commit d9a32c7

File tree

5 files changed

+38
-4
lines changed

5 files changed

+38
-4
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,18 @@ 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-
After configuring the command, you can execute it in the terminal:
75+
After configuring and registering the command, you can execute it in the terminal:
6876

6977
.. code-block:: terminal
7078

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
@@ -215,3 +220,14 @@ You can combine ``VALUE_IS_ARRAY`` with ``VALUE_REQUIRED`` or
215220
Similarly, due to a PHP limitation, there is no way to pass an empty string
216221
as the value of an option. In ``command --prefix`` and ``command --prefix=''``
217222
cases, the value of the ``prefix`` option will be ``null``.
223+
224+
.. caution::
225+
226+
While it is possible to separate an option from its value with a white space,
227+
using this form leads to an ambiguity should the option appear before the
228+
command name. For example, ``php bin/console --iterations 5 app:greet Fabien``
229+
is ambiguous; Symfony would interpret ``5`` as the command name. To avoid
230+
this situation, always place options after the command name, or avoid using
231+
a space to separate the option name from its value.
232+
233+
.. _`docopt standard`: http://docopt.org/

page_creation.rst

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

42+
<?php
4243
// src/AppBundle/Controller/LuckyController.php
4344
namespace AppBundle\Controller;
4445

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)