Skip to content

Commit 2b027a9

Browse files
committed
Merge branch '3.1'
Conflicts: reference/configuration/framework.rst
2 parents c5328d7 + 4240817 commit 2b027a9

20 files changed

+102
-66
lines changed

best_practices/business-logic.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Inside here, you can create whatever directories you want to organize things:
1515

1616
.. code-block:: text
1717
18-
symfony2-project/
18+
symfony-project/
1919
├─ app/
2020
├─ src/
2121
│ └─ AppBundle/
@@ -35,7 +35,7 @@ and put things there:
3535

3636
.. code-block:: text
3737
38-
symfony2-project/
38+
symfony-project/
3939
├─ app/
4040
├─ src/
4141
│ ├─ Acme/
@@ -180,7 +180,7 @@ The three entities defined by our sample blog application are a good example:
180180

181181
.. code-block:: text
182182
183-
symfony2-project/
183+
symfony-project/
184184
├─ ...
185185
└─ src/
186186
└─ AppBundle/

best_practices/controllers.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ it more difficult to know which template is being rendered. It also makes
8585
it less obvious to beginners that a controller should always return a Response
8686
object (unless you're using a view layer).
8787

88-
How the Controller Looks
89-
------------------------
88+
What does the Controller look like
89+
----------------------------------
9090

91-
Considering all this, here is an example of how the controller should look
91+
Considering all this, here is an example of what the controller should look like
9292
for the homepage of our app:
9393

9494
.. code-block:: php

components/cache/cache_pools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ is ``getItem($key)``, which returns the cache item identified by the given key::
169169

170170
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
171171

172-
$cache = new FilesystemAdapter('app.cache')
172+
$cache = new FilesystemAdapter('app.cache');
173173
$latestNews = $cache->getItem('latest_news');
174174

175175
If no item is defined for the given key, the method doesn't return a ``null``

components/expression_language.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ How can the Expression Engine Help Me?
2121
--------------------------------------
2222

2323
The purpose of the component is to allow users to use expressions inside
24-
configuration for more complex logic. For some examples, the Symfony2 Framework
24+
configuration for more complex logic. For some examples, the Symfony Framework
2525
uses expressions in security, for validation rules and in route matching.
2626

2727
Besides using the component in the framework itself, the ExpressionLanguage

components/filesystem.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ On POSIX filesystems, directories are created with a default mode value
6060
You can pass an array or any :phpclass:`Traversable` object as the first
6161
argument.
6262

63+
.. note::
64+
65+
This function ignores already existing directories.
66+
6367
exists
6468
~~~~~~
6569

components/yaml/yaml_format.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ YAML uses the ISO-8601 standard to express dates:
158158

159159
.. code-block:: yaml
160160
161-
2001-12-14t21:59:43.10-05:00
161+
2001-12-14T21:59:43.10-05:00
162162
163163
.. code-block:: yaml
164164

configuration.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ There are *two* ways to know *what* keys you can configure:
112112

113113
#. Use the :doc:`Reference Section </reference/index>`;
114114

115-
#. Use the ``config:dump`` command;
115+
#. Use the ``config:dump-reference`` command.
116116

117117
For example, if you want to configure something in Twig, you can see an example
118118
dump of all available configuration options by running:
119119

120120
.. code-block:: terminal
121121
122-
$ php bin/console config:dump twig
122+
$ php bin/console config:dump-reference twig
123123
124124
.. index::
125125
single: Environments; Introduction
@@ -183,7 +183,7 @@ can also load XML files or PHP files.
183183

184184
.. _config-parameter-intro:
185185

186-
The parameters key: Parameters (Variables)
186+
The parameters Key: Parameters (Variables)
187187
------------------------------------------
188188

189189
Another special key is called ``parameters``: it's used to define *variables* that

configuration/micro_kernel_trait.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ to hold the kernel. Now it looks like this::
199199
// optional, to use the standard Symfony cache directory
200200
public function getCacheDir()
201201
{
202-
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
202+
return __DIR__.'/../var/cache/'.$this->getEnvironment();
203203
}
204204

205205
// optional, to use the standard Symfony logs directory
206206
public function getLogDir()
207207
{
208-
return dirname(__DIR__).'/var/logs';
208+
return __DIR__.'/../var/logs';
209209
}
210210
}
211211

controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ object. To get it in your controller, just add it as an argument and
320320

321321
use Symfony\Component\HttpFoundation\Request;
322322

323-
public function indexAction($firstName, $lastName, Request $request)
323+
public function indexAction(Request $request, $firstName, $lastName)
324324
{
325325
$page = $request->query->get('page', 1);
326326

form/form_dependencies.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Next, register this as a service and tag it with ``form.type``:
101101
services:
102102
app.form.type.task:
103103
class: AppBundle\Form\TaskType
104+
arguments: ['@doctrine.orm.entity_manager']
104105
tags:
105106
- { name: form.type }
106107
@@ -114,6 +115,7 @@ Next, register this as a service and tag it with ``form.type``:
114115
115116
<services>
116117
<service id="app.form.type.task" class="AppBundle\Form\TaskType">
118+
<argument type="service" id="doctrine.orm.entity_manager"/>
117119
<tag name="form.type" />
118120
</service>
119121
</services>
@@ -127,6 +129,7 @@ Next, register this as a service and tag it with ``form.type``:
127129
'app.form.type.task',
128130
'AppBundle\Form\TaskType'
129131
)
132+
->addArgument('@doctrine.orm.entity_manager')
130133
->addTag('form.type')
131134
;
132135

page_creation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ to creating a page?
8686
#. *Create a controller*: The method below the route - ``numberAction()`` - is called
8787
the *controller*: this is a function where *you* build the page and ultimately
8888
return a ``Response`` object. You'll learn more about :doc:`controllers </controller>`
89-
in their own section, including how to return JSON responses;
89+
in their own section, including how to return JSON responses.
9090

9191
The Web Debug Toolbar: Debugging Dream
9292
--------------------------------------
@@ -134,7 +134,7 @@ variable so we can render that::
134134
$number = mt_rand(0, 100);
135135

136136
return $this->render('lucky/number.html.twig', array(
137-
'number' => $number
137+
'number' => $number,
138138
));
139139
}
140140
}
@@ -184,7 +184,7 @@ So what about the other directories in the project?
184184

185185
``var/``
186186
This is where automatically-created files are stored, like cache files
187-
(``var/cache/``) and logs (``var/logs/``).
187+
(``var/cache/``), logs (``var/logs/``) and sessions (``var/sessions/``).
188188

189189
``vendor/``
190190
Third-party (i.e. "vendor") libraries live here! These are downloaded via the `Composer`_

reference/configuration/framework.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Configuration
100100
* :ref:`enabled <reference-serializer-enabled>`
101101
* :ref:`cache <reference-serializer-cache>`
102102
* :ref:`enable_annotations <reference-serializer-enable_annotations>`
103-
* `name_converter`_
103+
* :ref:`name_converter <reference-serializer-name_converter>`
104104
* `php_errors`_
105105
* `log`_
106106
* `throw`_
@@ -1418,11 +1418,16 @@ If this option is enabled, serialization groups can be defined using annotations
14181418

14191419
For more information, see :ref:`serializer-using-serialization-groups-annotations`.
14201420

1421+
.. _reference-serializer-name_converter:
1422+
14211423
name_converter
14221424
..............
14231425

14241426
**type**: ``string``
14251427

1428+
.. versionadded:: 2.8
1429+
The ``name_converter`` option was introduced in Symfony 2.8.
1430+
14261431
The name converter to use.
14271432
The :class:`Symfony\\Component\\Serializer\\NameConverter\\CamelCaseToSnakeCaseNameConverter`
14281433
name converter can enabled by using the ``serializer.name_converter.camel_case_to_snake_case``

reference/constraints/UniqueEntity.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,18 @@ message
132132

133133
**type**: ``string`` **default**: ``This value is already used.``
134134

135-
The message that's displayed when this constraint fails.
135+
The message that's displayed when this constraint fails. This message is always
136+
mapped to the first field causing the violation, even when using multiple fields
137+
in the constraint.
138+
139+
.. versionadded:: 3.1
140+
The ability to include the invalid value into the message was introduced
141+
in Symfony 3.1.
142+
143+
Messages can include the ``{{ value }}`` placeholder to display a string
144+
representation of the invalid entity. If the entity doesn't define the
145+
``__toString()`` method, the following generic value will be used: *"Object of
146+
class __CLASS__ identified by <comma separated IDs>"*
136147

137148
em
138149
~~

routing.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Thanks to these two routes:
120120

121121
* If the user goes to ``/blog/*``, the second route is matched and ``showAction()``
122122
is executed. Because the route path is ``/blog/{slug}``, a ``$slug`` variable is
123-
passed to ``showAction`` matching that value. For example, if the user goes to
123+
passed to ``showAction()`` matching that value. For example, if the user goes to
124124
``/blog/yay-routing``, then ``$slug`` will equal ``yay-routing``.
125125

126126
Whenever you have a ``{placeholder}`` in your route path, that portion becomes a
@@ -363,7 +363,7 @@ With all of this in mind, check out this advanced example:
363363
{
364364
/**
365365
* @Route(
366-
* "/articles/{_locale}/{year}/{title}.{_format}",
366+
* "/articles/{_locale}/{year}/{slug}.{_format}",
367367
* defaults={"_format": "html"},
368368
* requirements={
369369
* "_locale": "en|fr",
@@ -372,7 +372,7 @@ With all of this in mind, check out this advanced example:
372372
* }
373373
* )
374374
*/
375-
public function showAction($_locale, $year, $title)
375+
public function showAction($_locale, $year, $slug)
376376
{
377377
}
378378
}
@@ -381,7 +381,7 @@ With all of this in mind, check out this advanced example:
381381
382382
# app/config/routing.yml
383383
article_show:
384-
path: /articles/{_locale}/{year}/{title}.{_format}
384+
path: /articles/{_locale}/{year}/{slug}.{_format}
385385
defaults: { _controller: AppBundle:Article:show, _format: html }
386386
requirements:
387387
_locale: en|fr
@@ -398,7 +398,7 @@ With all of this in mind, check out this advanced example:
398398
http://symfony.com/schema/routing/routing-1.0.xsd">
399399
400400
<route id="article_show"
401-
path="/articles/{_locale}/{year}/{title}.{_format}">
401+
path="/articles/{_locale}/{year}/{slug}.{_format}">
402402
403403
<default key="_controller">AppBundle:Article:show</default>
404404
<default key="_format">html</default>
@@ -418,7 +418,7 @@ With all of this in mind, check out this advanced example:
418418
$collection = new RouteCollection();
419419
$collection->add(
420420
'article_show',
421-
new Route('/articles/{_locale}/{year}/{title}.{_format}', array(
421+
new Route('/articles/{_locale}/{year}/{slug}.{_format}', array(
422422
'_controller' => 'AppBundle:Article:show',
423423
'_format' => 'html',
424424
), array(
@@ -509,11 +509,11 @@ The pattern has three parts, each separated by a colon:
509509

510510
For example, a ``_controller`` value of ``AppBundle:Blog:show`` means:
511511

512-
============= ================== ==============
512+
============= ================== ================
513513
Bundle Controller Class Method Name
514-
============= ================== ==============
515-
``AppBundle`` ``BlogController`` ``showAction``
516-
============= ================== ==============
514+
============= ================== ================
515+
``AppBundle`` ``BlogController`` ``showAction()``
516+
============= ================== ================
517517

518518
The controller might look like this::
519519

@@ -531,7 +531,7 @@ The controller might look like this::
531531
}
532532

533533
Notice that Symfony adds the string ``Controller`` to the class name (``Blog``
534-
=> ``BlogController``) and ``Action`` to the method name (``show`` => ``showAction``).
534+
=> ``BlogController``) and ``Action`` to the method name (``show`` => ``showAction()``).
535535

536536
You could also refer to this controller using its fully-qualified class name
537537
and method: ``AppBundle\Controller\BlogController::showAction``. But if you

serializer.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,12 @@ A service leveraging `APCu`_ (and APC for PHP < 5.5) is built-in.
225225
Enabling a Name Converter
226226
-------------------------
227227

228+
.. versionadded:: 2.8
229+
The ``name_converter`` option was introduced in Symfony 2.8.
230+
228231
The use of a :ref:`name converter <component-serializer-converting-property-names-when-serializing-and-deserializing>`
229-
service can be defined in the configuration using the ``name_converter``
230-
serializer parameter.
232+
service can be defined in the configuration using the :ref:`name_converter <reference-serializer-name_converter>`
233+
option.
231234

232235
The built-in :ref:`CamelCase to snake_case name converter <using-camelized-method-names-for-underscored-attributes>`
233236
can be enabled by using the ``serializer.name_converter.camel_case_to_snake_case``

service_container/service_decoration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ the original service is lost:
1818
# this replaces the old app.mailer definition with the new one, the
1919
# old definition is lost
2020
app.mailer:
21-
class AppBundle\DecoratingMailer
21+
class: AppBundle\DecoratingMailer
2222
2323
.. code-block:: xml
2424

setup.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ optional second argument of the ``new`` command:
9696
# use the most recent 'lts' version (Long Term Support version)
9797
$ symfony new my_project_name lts
9898
99+
Each version has its *own* documentation, which you can select on any documentation
100+
page.
101+
99102
.. note::
100103

101104
Read the :doc:`Symfony Release process </contributing/community/releases>`
@@ -294,7 +297,7 @@ Go Deeper with Setup
294297
.. _`Phar extension`: http://php.net/manual/en/intro.phar.php
295298
.. _`Symfony Standard Edition`: https://github.com/symfony/symfony-standard
296299
.. _`The Symfony Demo application`: https://github.com/symfony/symfony-demo
297-
.. _`The Symfony CMF Standard Edition`: https://github.com/symfony-cmf/symfony-cmf-standard
300+
.. _`The Symfony CMF Standard Edition`: https://github.com/symfony-cmf/standard-edition
298301
.. _`Symfony CMF`: http://cmf.symfony.com/
299302
.. _`The Symfony REST Edition`: https://github.com/gimler/symfony-rest-edition
300303
.. _`FOSRestBundle`: https://github.com/FriendsOfSymfony/FOSRestBundle

setup/bundles.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ adding a ``setDefined()`` method. The recommended check in this case would be::
189189
// code for the new OptionsResolver API
190190
}
191191

192+
.. tip::
193+
194+
There is one case when you actually can rely on the
195+
``Symfony\Component\HttpKernel\Kernel::VERSION_ID`` constant: when trying
196+
to detect the version of the ``symfony/http-kernel`` component, because it
197+
is the component where this constant is defined.
198+
192199
.. _`symfony/phpunit-bridge package`: https://github.com/symfony/phpunit-bridge
193200
.. _`Official Symfony Guide to Upgrade from 2.x to 3.0`: https://github.com/symfony/symfony/blob/2.8/UPGRADE-3.0.md
194201
.. _`SensioLabs DeprecationDetector`: https://github.com/sensiolabs-de/deprecation-detector

0 commit comments

Comments
 (0)