Skip to content

Commit e6da57b

Browse files
committed
Merge branch '2.7' into 2.8
2 parents 9448b1b + c775a6f commit e6da57b

File tree

7 files changed

+147
-51
lines changed

7 files changed

+147
-51
lines changed

book/controller.rst

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -321,42 +321,42 @@ Keep the following guidelines in mind while you develop.
321321

322322
#. **The order of the controller arguments does not matter**
323323

324-
Symfony matches the parameter **names** from the route to the variable
325-
**names** of the controller. The arguments of the controller could be
326-
totally reordered and still work perfectly::
324+
Symfony matches the parameter **names** from the route to the variable
325+
**names** of the controller. The arguments of the controller could be
326+
totally reordered and still work perfectly::
327327

328-
public function indexAction($lastName, $firstName)
329-
{
330-
// ...
331-
}
328+
public function indexAction($lastName, $firstName)
329+
{
330+
// ...
331+
}
332332

333333
#. **Each required controller argument must match up with a routing parameter**
334334

335-
The following would throw a ``RuntimeException`` because there is no
336-
``foo`` parameter defined in the route::
335+
The following would throw a ``RuntimeException`` because there is no
336+
``foo`` parameter defined in the route::
337337

338-
public function indexAction($firstName, $lastName, $foo)
339-
{
340-
// ...
341-
}
338+
public function indexAction($firstName, $lastName, $foo)
339+
{
340+
// ...
341+
}
342342

343-
Making the argument optional, however, is perfectly ok. The following
344-
example would not throw an exception::
343+
Making the argument optional, however, is perfectly ok. The following
344+
example would not throw an exception::
345345

346-
public function indexAction($firstName, $lastName, $foo = 'bar')
347-
{
348-
// ...
349-
}
346+
public function indexAction($firstName, $lastName, $foo = 'bar')
347+
{
348+
// ...
349+
}
350350

351351
#. **Not all routing parameters need to be arguments on your controller**
352352

353-
If, for example, the ``lastName`` weren't important for your controller,
354-
you could omit it entirely::
353+
If, for example, the ``lastName`` weren't important for your controller,
354+
you could omit it entirely::
355355

356-
public function indexAction($firstName)
357-
{
358-
// ...
359-
}
356+
public function indexAction($firstName)
357+
{
358+
// ...
359+
}
360360

361361
.. tip::
362362

book/installation.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,9 @@ If there are any issues, correct them now before moving on.
230230
its user to be the same as your CLI user (e.g. for Apache, update the ``User``
231231
and ``Group`` values).
232232

233-
**2. Using ACL on a system that supports chmod +a**
233+
**2. Using ACL on a system that supports chmod +a (MacOS X)**
234234

235-
Many systems allow you to use the ``chmod +a`` command. Try this first,
236-
and if you get an error - try the next method. This uses a command to
235+
MacOS X allows you to use the ``chmod +a`` command. This uses a command to
237236
try to determine your web server user and set it as ``HTTPDUSER``:
238237

239238
.. code-block:: bash
@@ -245,14 +244,12 @@ If there are any issues, correct them now before moving on.
245244
$ sudo chmod +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
246245
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
247246
247+
**3. Using ACL on a system that supports setfacl (most Linux/BSD)**
248248

249-
**3. Using ACL on a system that does not support chmod +a**
250-
251-
Some systems don't support ``chmod +a``, but do support another utility
252-
called ``setfacl``. You may need to `enable ACL support`_ on your partition
253-
and install setfacl before using it (as is the case with Ubuntu). This
254-
uses a command to try to determine your web server user and set it as
255-
``HTTPDUSER``:
249+
Most Linux and BSD distributions don't support ``chmod +a``, but do support
250+
another utility called ``setfacl``. You may need to `enable ACL support`_
251+
on your partition and install setfacl before using it. This uses a command
252+
to try to determine your web server user and set it as ``HTTPDUSER``:
256253

257254
.. code-block:: bash
258255
@@ -262,6 +259,11 @@ If there are any issues, correct them now before moving on.
262259
263260
If this doesn't work, try adding ``-n`` option.
264261

262+
.. note::
263+
264+
setfacl isn't available on NFS mount points. However, setting cache
265+
and logs over NFS is strongly not recommended for performance.
266+
265267
**4. Without using ACL**
266268

267269
If none of the previous methods work for you, change the umask so that the

book/routing.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,13 @@ Path Parameters
805805
``/es`` *won't match this route*
806806
======= ========================
807807

808+
.. tip::
809+
810+
The route requirements can also include container parameters, as explained
811+
in :doc:`this article </cookbook/routing/service_container_parameters>`.
812+
This comes in handy when the regular expression is very complex and used
813+
repeatedly in your application.
814+
808815
.. index::
809816
single: Routing; Method requirement
810817

changelog.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,51 @@ documentation.
1313
Do you also want to participate in the Symfony Documentation? Take a look
1414
at the ":doc:`/contributing/documentation/overview`" article.
1515

16+
April, 2016
17+
-----------
18+
19+
New Documentation
20+
~~~~~~~~~~~~~~~~~
21+
22+
* `#6470 <https://github.com/symfony/symfony-docs/pull/6470>`_ Documented the config options of TwigBundle (javiereguiluz)
23+
* `#6427 <https://github.com/symfony/symfony-docs/pull/6427>`_ [Testing] Explain how to add or remove data in a collection of forms (alexislefebvre)
24+
* `#6394 <https://github.com/symfony/symfony-docs/pull/6394>`_ Updated Heroku instructions (magnusnordlander)
25+
26+
Fixed Documentation
27+
~~~~~~~~~~~~~~~~~~~
28+
29+
* `#6503 <https://github.com/symfony/symfony-docs/pull/6503>`_ Fix typo in from flat PHP to Symfony (gregfriedrice, WouterJ)
30+
* `#6483 <https://github.com/symfony/symfony-docs/pull/6483>`_ Fix typo: signifcantly => significantly (ifdattic)
31+
* `#6482 <https://github.com/symfony/symfony-docs/pull/6482>`_ fixed wrong secret string in array examples (OskarStark)
32+
* `#6460 <https://github.com/symfony/symfony-docs/pull/6460>`_ Update authorization.rst (mantulo)
33+
* `#6451 <https://github.com/symfony/symfony-docs/pull/6451>`_ fix status code in snippet (Barno)
34+
* `#6448 <https://github.com/symfony/symfony-docs/pull/6448>`_ [Form] fixed CollectionType needless option (HeahDude)
35+
* `#6439 <https://github.com/symfony/symfony-docs/pull/6439>`_ Fix form/validation directory path (nemo-)
36+
37+
Minor Documentation Changes
38+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
39+
40+
* `#6522 <https://github.com/symfony/symfony-docs/pull/6522>`_ On line 360 the ``404 Not Found`` header not working (mbrig-co)
41+
* `#6521 <https://github.com/symfony/symfony-docs/pull/6521>`_ The ``$link`` argument must be passed as a reference (mbrig-co)
42+
* `#6523 <https://github.com/symfony/symfony-docs/pull/6523>`_ Fix snippet (ismailbaskin)
43+
* `#6472 <https://github.com/symfony/symfony-docs/pull/6472>`_ Avoid confusion (gerryvdm)
44+
* `#6300 <https://github.com/symfony/symfony-docs/pull/6300>`_ Document constraint validator alias optional (Triiistan)
45+
* `#6513 <https://github.com/symfony/symfony-docs/pull/6513>`_ remove documentation of not supported "verbose" option value (TobiasXy)
46+
* `#6510 <https://github.com/symfony/symfony-docs/pull/6510>`_ use port 587 in Amazon SES example (snoek09)
47+
* `#6464 <https://github.com/symfony/symfony-docs/pull/6464>`_ Added possible values for access_decision_manager.strategy (AAstakhov)
48+
* `#6478 <https://github.com/symfony/symfony-docs/pull/6478>`_ Replace reference to the request service (gerryvdm)
49+
* `#6479 <https://github.com/symfony/symfony-docs/pull/6479>`_ Update php.rst (carlos-granados)
50+
* `#6481 <https://github.com/symfony/symfony-docs/pull/6481>`_ Remove reference to Symfony2 in request-flow.png (Daniel Cotton)
51+
* `#6449 <https://github.com/symfony/symfony-docs/pull/6449>`_ [Form] fixed ChoiceType example in CollectionType (HeahDude)
52+
* `#6445 <https://github.com/symfony/symfony-docs/pull/6445>`_ updated the core team (fabpot)
53+
* `#6423 <https://github.com/symfony/symfony-docs/pull/6423>`_ Added a caution note about REMOTE_USER and user impersonation (javiereguiluz)
54+
* `#6452 <https://github.com/symfony/symfony-docs/pull/6452>`_ Use different placeholders in mailer config (sblaut)
55+
* `#6457 <https://github.com/symfony/symfony-docs/pull/6457>`_ Fixed an array notation in comment (serializer.rst) (iltar)
56+
* `#6456 <https://github.com/symfony/symfony-docs/pull/6456>`_ Fixed array [] notation and trailing spaces (iltar)
57+
* `#6420 <https://github.com/symfony/symfony-docs/pull/6420>`_ Added tip for optional second parameter for form submissions. (Michael Phillips)
58+
* `#6418 <https://github.com/symfony/symfony-docs/pull/6418>`_ fix spelling of the flashBag() method (xabbuh)
59+
60+
1661
March, 2016
1762
-----------
1863

components/dependency_injection/definitions.rst

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
Working with Container Service Definitions
55
==========================================
66

7+
Service definitions are the instructions describing how the container should
8+
build a service. They are not the actual services used by your applications
9+
710
Getting and Setting Service Definitions
811
---------------------------------------
912

@@ -32,34 +35,68 @@ with these methods and make changes to it these will be reflected in the
3235
container. If, however, you are creating a new definition then you can add
3336
it to the container using::
3437

35-
$container->setDefinition($id, $definition);
38+
use Symfony\Component\DependencyInjection\Definition;
39+
40+
$definition = new Definition('Acme\Service\MyService');
41+
$container->setDefinition('acme.my_service', $definition);
42+
43+
.. tip::
44+
45+
Registering service definitions is so common that the container provides a
46+
shortcut method called ``register()``::
47+
48+
$container->register('acme.my_service', 'Acme\Service\MyService');
3649

3750
Working with a Definition
3851
-------------------------
3952

4053
Creating a New Definition
4154
~~~~~~~~~~~~~~~~~~~~~~~~~
4255

43-
If you need to create a new definition rather than manipulate one retrieved
44-
from the container then the definition class is :class:`Symfony\\Component\\DependencyInjection\\Definition`.
56+
In addition to manipulating and retrieving existing definitions, you can also
57+
define new service definitions with the :class:`Symfony\\Component\\DependencyInjection\\Definition`
58+
class.
4559

4660
Class
4761
~~~~~
4862

49-
First up is the class of a definition, this is the class of the object returned
50-
when the service is requested from the container.
63+
The first optional argument of the ``Definition`` class is the fully qualified
64+
class name of the object returned when the service is fetched from the container::
5165

52-
To find out what class is set for a definition::
66+
use Symfony\Component\DependencyInjection\Definition;
67+
68+
$definition = new Definition('Acme\Service\MyService');
69+
70+
If the class is unknown when instantiating the ``Definition`` class, use the
71+
``setClass()`` method to set it later::
5372

54-
$definition->getClass();
73+
$definition->setClass('Acme\Service\MyService');
5574

56-
and to set a different class::
75+
To find out what class is set for a definition::
5776

58-
$definition->setClass($class); // Fully qualified class name as string
77+
$class = $definition->getClass();
78+
// $class = 'Acme\Service\MyService'
5979

6080
Constructor Arguments
6181
~~~~~~~~~~~~~~~~~~~~~
6282

83+
The second optional argument of the ``Definition`` class is an array with the
84+
arguments passed to the constructor of the object returned when the service is
85+
fetched from the container::
86+
87+
use Symfony\Component\DependencyInjection\Definition;
88+
89+
$definition = new Definition(
90+
'Acme\Service\MyService',
91+
array('argument1' => 'value1', 'argument2' => 'value2')
92+
);
93+
94+
If the arguments are unknown when instantiating the ``Definition`` class or if
95+
you want to add new arguments, use the ``addArgument()`` method, which adds them
96+
at the end of the arguments array::
97+
98+
$definition->addArgument($argument);
99+
63100
To get an array of the constructor arguments for a definition you can use::
64101

65102
$definition->getArguments();
@@ -69,12 +106,16 @@ or to get a single argument by its position::
69106
$definition->getArgument($index);
70107
// e.g. $definition->getArgument(0) for the first argument
71108

72-
You can add a new argument to the end of the arguments array using::
109+
The argument can be a string, an array or a service parameter by using the
110+
``%parameter_name%`` syntax::
73111

74-
$definition->addArgument($argument);
112+
$definition->addArgument('%kernel_debug%');
75113

76-
The argument can be a string, an array, a service parameter by using ``%parameter_name%``
77-
or a service id by using::
114+
If the argument is another service, don't use the ``get()`` method to fetch it,
115+
because it won't be available when defining services. Instead, use the
116+
:class:`Symfony\\Component\\DependencyInjection\\Reference` class to get a
117+
reference to the service which will be available once the service container is
118+
fully built::
78119

79120
use Symfony\Component\DependencyInjection\Reference;
80121

@@ -139,4 +180,3 @@ the service itself gets loaded. To do so, you can use the
139180

140181
Notice that Symfony will internally call the PHP statement ``require_once``,
141182
which means that your file will be included only once per request.
142-

components/dependency_injection/introduction.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ like this::
104104
// ...
105105
}
106106

107-
Then you can register this as a service as well and pass the ``mailer`` service into it::
107+
When defining the ``newsletter_manager`` service, the ``mailer`` service does
108+
not exist yet. Use the ``Reference`` class to tell the container to inject the
109+
``mailer`` service when it initializes the newsletter manager::
108110

109111
use Symfony\Component\DependencyInjection\ContainerBuilder;
110112
use Symfony\Component\DependencyInjection\Reference;

contributing/community/releases.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,4 @@ version is published every two years and there is a year to upgrade.
187187
.. _SensioLabs: http://sensiolabs.com/
188188
.. _roadmap notification: https://symfony.com/roadmap
189189
.. _extended to September 2014: https://symfony.com/blog/extended-maintenance-for-symfony-2-4
190-
.. _timeline calculator: https://symfony.com/roadmap
190+
.. _timeline calculator: https://symfony.com/roadmap#checker

0 commit comments

Comments
 (0)