Skip to content

Commit e87e9ee

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: [symfony#6219] some tweaks Point that route parameters are also Request attributes [symfony#6348] some minor tweaks [best practices] mostly typos [symfony#6275] some minor tweaks [quick tour] mostly typos remove link-local IPv6 address (fe80::1) [symfony#6305] move link reference to the bottom Mention IvoryCKEditorBundle in the Symfony Forms doc [symfony#6328] minor tweak Update extension.rst - added caution box for people trying to remove the default file with services definitions Altered single / multiple inheritance sentence Replace XLIFF number ids by strings Rename DunglasApiBundle to ApiPlatform
2 parents 01133fd + 82ba7db commit e87e9ee

20 files changed

+114
-89
lines changed

Diff for: best_practices/business-logic.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ The three entities defined by our sample blog application are a good example:
193193
Doctrine Mapping Information
194194
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195195

196-
Doctrine Entities are plain PHP objects that you store in some "database".
196+
Doctrine entities are plain PHP objects that you store in some "database".
197197
Doctrine only knows about your entities through the mapping metadata configured
198198
for your model classes. Doctrine supports four metadata formats: YAML, XML,
199199
PHP and annotations.

Diff for: best_practices/configuration.rst

+1-3
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ If you've done something like this in the past, it's likely that you've in fact
107107
*never* actually needed to change that value. Creating a configuration
108108
option for a value that you are never going to configure just isn't necessary.
109109
Our recommendation is to define these values as constants in your application.
110-
You could, for example, define a ``NUM_ITEMS`` constant in the ``Post`` entity:
111-
112-
.. code-block:: php
110+
You could, for example, define a ``NUM_ITEMS`` constant in the ``Post`` entity::
113111

114112
// src/AppBundle/Entity/Post.php
115113
namespace AppBundle\Entity;

Diff for: best_practices/controllers.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Template Configuration
7373

7474
.. best-practice::
7575

76-
Don't use the ``@Template()`` annotation to configure the template used by
76+
Don't use the ``@Template`` annotation to configure the template used by
7777
the controller.
7878

7979
The ``@Template`` annotation is useful, but also involves some magic. We
@@ -148,7 +148,7 @@ For example:
148148
));
149149
}
150150
151-
Normally, you'd expect a ``$id`` argument to ``showAction``. Instead, by
151+
Normally, you'd expect a ``$id`` argument to ``showAction()``. Instead, by
152152
creating a new argument (``$post``) and type-hinting it with the ``Post``
153153
class (which is a Doctrine entity), the ParamConverter automatically queries
154154
for an object whose ``$id`` property matches the ``{id}`` value. It will

Diff for: best_practices/creating-the-project.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ ProductBundle, then there's no advantage to having two separate bundles.
104104

105105
.. best-practice::
106106

107-
Create only one bundle called AppBundle for your application logic
107+
Create only one bundle called AppBundle for your application logic.
108108

109109
Implementing a single AppBundle bundle in your projects will make your code
110110
more concise and easier to understand. Starting in Symfony 2.6, the official
@@ -179,8 +179,6 @@ The changes are pretty superficial, but for now, we recommend that you use
179179
the Symfony directory structure.
180180

181181
.. _`Composer`: https://getcomposer.org/
182-
.. _`Get Started`: https://getcomposer.org/doc/00-intro.md
183-
.. _`Composer download page`: https://getcomposer.org/download/
184-
.. _`public checksums repository`: https://github.com/sensiolabs/checksums
185-
.. _`these steps`: http://fabien.potencier.org/signing-project-releases.html
186182
.. _`Phar extension`: http://php.net/manual/en/intro.phar.php
183+
.. _`public checksums repository`: https://github.com/sensiolabs/checksums
184+
.. _`these steps`: http://fabien.potencier.org/signing-project-releases.html

Diff for: best_practices/forms.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ form in its own PHP class::
5252
Put the form type classes in the ``AppBundle\Form`` namespace, unless you
5353
use other custom form classes like data transformers.
5454

55-
To use the class, use ``createForm`` and pass the fully qualified class name::
55+
To use the class, use ``createForm()`` and pass the fully qualified class name::
5656

5757
// ...
5858
use AppBundle\Form\PostType;
@@ -155,8 +155,8 @@ thing in one line to rendering each part of each field independently. The
155155
best way depends on how much customization you need.
156156

157157
One of the simplest ways - which is especially useful during development -
158-
is to render the form tags and use ``form_widget()`` to render all of the
159-
fields:
158+
is to render the form tags and use the ``form_widget()`` function to render
159+
all of the fields:
160160

161161
.. code-block:: html+twig
162162

@@ -166,7 +166,7 @@ fields:
166166

167167
If you need more control over how your fields are rendered, then you should
168168
remove the ``form_widget(form)`` function and render your fields individually.
169-
See the :doc:`/cookbook/form/form_customization` article for more information
169+
See the :doc:`/cookbook/form/form_customization` cookbook article for more information
170170
on this and how you can control *how* the form renders at a global level
171171
using form theming.
172172

@@ -199,9 +199,9 @@ Handling a form submit usually follows a similar template:
199199
200200
There are really only two notable things here. First, we recommend that you
201201
use a single action for both rendering the form and handling the form submit.
202-
For example, you *could* have a ``newAction`` that *only* renders the form
203-
and a ``createAction`` that *only* processes the form submit. Both those
204-
actions will be almost identical. So it's much simpler to let ``newAction``
202+
For example, you *could* have a ``newAction()`` that *only* renders the form
203+
and a ``createAction()`` that *only* processes the form submit. Both those
204+
actions will be almost identical. So it's much simpler to let ``newAction()``
205205
handle everything.
206206

207207
Second, we recommend using ``$form->isSubmitted()`` in the ``if`` statement

Diff for: best_practices/i18n.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ Translation Source File Location
4747

4848
.. best-practice::
4949

50-
Store the translation files in the ``app/Resources/translations/`` directory.
50+
Store the translation files in the ``app/Resources/translations/``
51+
directory.
5152

5253
Traditionally, Symfony developers have created these files in the
53-
``Resources/translations/`` directory of each bundle.
54-
55-
But since the ``app/Resources/`` directory is considered the global location
56-
for the application's resources, storing translations in ``app/Resources/translations/``
54+
``Resources/translations/`` directory of each bundle. But since the
55+
``app/Resources/`` directory is considered the global location for the
56+
application's resources, storing translations in ``app/Resources/translations/``
5757
centralizes them *and* gives them priority over any other translation file.
58-
This lets you override translations defined in third-party bundles.
58+
This let's you override translations defined in third-party bundles.
5959

6060
Translation Keys
6161
----------------
@@ -85,7 +85,7 @@ English in the application would be:
8585
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
8686
<file source-language="en" target-language="en" datatype="plaintext" original="file.ext">
8787
<body>
88-
<trans-unit id="1">
88+
<trans-unit id="title_post_list">
8989
<source>title.post_list</source>
9090
<target>Post List</target>
9191
</trans-unit>

Diff for: best_practices/tests.rst

+4-6
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ functional tests, you can quickly spot any big errors before you deploy them:
2626
Define a functional test that at least checks if your application pages
2727
are successfully loading.
2828

29-
A functional test can be as easy as this:
30-
31-
.. code-block:: php
29+
A functional test can be as easy as this::
3230

3331
// src/AppBundle/Tests/ApplicationAvailabilityFunctionalTest.php
3432
namespace AppBundle\Tests;
@@ -116,10 +114,10 @@ Learn More about Functional Tests
116114
Consider using the `HautelookAliceBundle`_ to generate real-looking data for
117115
your test fixtures using `Faker`_ and `Alice`_.
118116

119-
.. _`Faker`: https://github.com/fzaninotto/Faker
120-
.. _`Alice`: https://github.com/nelmio/alice
121117
.. _`PhpUnit`: https://phpunit.de/
122118
.. _`PhpSpec`: http://www.phpspec.net/
123-
.. _`Mink`: http://mink.behat.org
124119
.. _`smoke testing`: https://en.wikipedia.org/wiki/Smoke_testing_(software)
120+
.. _`Mink`: http://mink.behat.org
125121
.. _`HautelookAliceBundle`: https://github.com/hautelook/AliceBundle
122+
.. _`Faker`: https://github.com/fzaninotto/Faker
123+
.. _`Alice`: https://github.com/nelmio/alice

Diff for: book/translation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ different formats, XLIFF being the recommended format:
134134
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
135135
<file source-language="en" datatype="plaintext" original="file.ext">
136136
<body>
137-
<trans-unit id="1">
137+
<trans-unit id="symfony_is_great">
138138
<source>Symfony is great</source>
139139
<target>J'aime Symfony</target>
140140
</trans-unit>
@@ -713,7 +713,7 @@ bundle.
713713
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
714714
<file source-language="en" datatype="plaintext" original="file.ext">
715715
<body>
716-
<trans-unit id="1">
716+
<trans-unit id="author.name.not_blank">
717717
<source>author.name.not_blank</source>
718718
<target>Please enter an author name.</target>
719719
</trans-unit>

Diff for: components/event_dispatcher/introduction.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ answer.
2222
Consider the real-world example where you want to provide a plugin system
2323
for your project. A plugin should be able to add methods, or do something
2424
before or after a method is executed, without interfering with other plugins.
25-
This is not an easy problem to solve with single and multiple inheritance
26-
(were it possible with PHP) has its own drawbacks.
25+
This is not an easy problem to solve with single inheritance, and even if
26+
multiple inheritance was possible with PHP, it comes with its own drawbacks.
2727

2828
The Symfony EventDispatcher component implements the `Mediator`_ pattern
2929
in a simple and effective way to make all these things possible and to make

Diff for: components/translation/usage.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ recommended format. These files are parsed by one of the loader classes.
115115
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
116116
<file source-language="en" datatype="plaintext" original="file.ext">
117117
<body>
118-
<trans-unit id="1">
118+
<trans-unit id="symfony_is_great">
119119
<source>Symfony is great</source>
120120
<target>J'aime Symfony</target>
121121
</trans-unit>
122-
<trans-unit id="2">
122+
<trans-unit id="symfony.great">
123123
<source>symfony.great</source>
124124
<target>J'aime Symfony</target>
125125
</trans-unit>

Diff for: cookbook/bundles/extension.rst

+6
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ Other available loaders are the ``YamlFileLoader``, ``PhpFileLoader`` and
113113
The ``IniFileLoader`` can only be used to load parameters and it can only
114114
load them as strings.
115115

116+
.. caution::
117+
118+
If you removed the default file with service definitions (i.e.
119+
``app/config/services.yml``), make sure to also remove it from the
120+
``imports`` key in ``app/config/config.yml``.
121+
116122
Using Configuration to Change the Services
117123
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118124

Diff for: cookbook/configuration/environments.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ The new environment is now accessible via::
328328
aren't accessible, the front controller is usually protected from external
329329
IP addresses via the following code at the top of the controller::
330330

331-
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))) {
331+
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) {
332332
die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
333333
}
334334

Diff for: cookbook/routing/extra_information.rst

+20-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
How to Pass Extra Information from a Route to a Controller
55
==========================================================
66

7-
Parameters inside the ``defaults`` collection don't necessarily have to
8-
match a placeholder in the route ``path``. In fact, you can use the
9-
``defaults`` array to specify extra parameters that will then be accessible as
10-
arguments to your controller:
7+
Parameters inside the ``defaults`` collection don't necessarily have to match
8+
a placeholder in the route ``path``. In fact, you can use the ``defaults``
9+
array to specify extra parameters that will then be accessible as arguments
10+
to your controller, and as attributes of the ``Request`` object:
1111

1212
.. configuration-block::
1313

@@ -52,12 +52,25 @@ arguments to your controller:
5252
5353
return $collection;
5454
55-
Now, you can access this extra parameter in your controller::
55+
Now, you can access this extra parameter in your controller, as an argument
56+
to the controller method::
5657

5758
public function indexAction($page, $title)
5859
{
5960
// ...
6061
}
6162

62-
As you can see, the ``$title`` variable was never defined inside the route path,
63-
but you can still access its value from inside your controller.
63+
Alternatively, the title could be accessed through the ``Request`` object::
64+
65+
use Symfony\Component\HttpFoundation\Request;
66+
67+
public function indexAction(Request $request, $page)
68+
{
69+
$title = $request->attributes->get('title');
70+
71+
// ...
72+
}
73+
74+
As you can see, the ``$title`` variable was never defined inside the route
75+
path, but you can still access its value from inside your controller, through
76+
the method's argument, or from the ``Request`` object's ``attributes`` bag.

Diff for: cookbook/security/access_control.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pattern so that it is only accessible by requests from the local server itself:
178178
# ...
179179
access_control:
180180
#
181-
- { path: ^/internal, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, fe80::1, ::1] }
181+
- { path: ^/internal, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] }
182182
- { path: ^/internal, roles: ROLE_NO_ACCESS }
183183
184184
.. code-block:: xml
@@ -195,7 +195,7 @@ pattern so that it is only accessible by requests from the local server itself:
195195
<!-- ... -->
196196
<rule path="^/internal"
197197
role="IS_AUTHENTICATED_ANONYMOUSLY"
198-
ips="127.0.0.1, fe80::1, ::1"
198+
ips="127.0.0.1, ::1"
199199
/>
200200
201201
<rule path="^/internal" role="ROLE_NO_ACCESS" />
@@ -211,7 +211,7 @@ pattern so that it is only accessible by requests from the local server itself:
211211
array(
212212
'path' => '^/internal',
213213
'role' => 'IS_AUTHENTICATED_ANONYMOUSLY',
214-
'ips' => '127.0.0.1, fe80::1, ::1'
214+
'ips' => '127.0.0.1, ::1'
215215
),
216216
array(
217217
'path' => '^/internal',
@@ -232,8 +232,8 @@ the external IP address ``10.0.0.1``:
232232
that does not match an existing role, it just serves as a trick to always
233233
deny access).
234234

235-
But if the same request comes from ``127.0.0.1``, ``::1`` (the IPv6 loopback
236-
address) or ``fe80::1`` (the IPv6 link-local address):
235+
But if the same request comes from ``127.0.0.1`` or ``::1`` (the IPv6 loopback
236+
address):
237237

238238
* Now, the first access control rule is enabled as both the ``path`` and the
239239
``ip`` match: access is allowed as the user always has the

Diff for: cookbook/serializer.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ A service leveraging `APCu`_ (and APC for PHP < 5.5) is built-in.
218218
Going Further with the Serializer Component
219219
-------------------------------------------
220220

221-
`DunglasApiBundle`_ provides an API system supporting `JSON-LD`_ and `Hydra Core Vocabulary`_
221+
`ApiPlatform`_ provides an API system supporting `JSON-LD`_ and `Hydra Core Vocabulary`_
222222
hypermedia formats. It is built on top of the Symfony Framework and its Serializer
223223
component. It provides custom normalizers and a custom encoder, custom metadata
224224
and a caching system.
@@ -227,6 +227,6 @@ If you want to leverage the full power of the Symfony Serializer component,
227227
take a look at how this bundle works.
228228

229229
.. _`APCu`: https://github.com/krakjoe/apcu
230-
.. _`DunglasApiBundle`: https://github.com/dunglas/DunglasApiBundle
230+
.. _`ApiPlatform`: https://github.com/api-platform/core
231231
.. _`JSON-LD`: http://json-ld.org
232232
.. _`Hydra Core Vocabulary`: http://hydra-cg.com

Diff for: quick_tour/the_architecture.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Understanding the Cache and Logs
257257
--------------------------------
258258

259259
Symfony applications can contain several configuration files defined in
260-
several formats (YAML, XML, PHP, etc.) Instead of parsing and combining
260+
several formats (YAML, XML, PHP, etc.). Instead of parsing and combining
261261
all those files for each request, Symfony uses its own cache system. In
262262
fact, the application configuration is only parsed for the very first request
263263
and then compiled down to plain PHP code stored in the ``app/cache/``
@@ -309,4 +309,4 @@ need to learn a lot to become a Symfony master. Ready to dig into these
309309
topics now? Look no further - go to the official :doc:`/book/index` and
310310
pick any topic you want.
311311

312-
.. _Composer: https://getcomposer.org
312+
.. _`Composer`: https://getcomposer.org

0 commit comments

Comments
 (0)