Skip to content

Commit 78d11d8

Browse files
committed
Merge branch '2.7' into 2.8
Conflicts: reference/configuration/security.rst
2 parents ecc2ca0 + 6971a77 commit 78d11d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+136
-150
lines changed

best_practices/business-logic.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ the class namespace as a parameter:
145145
146146
services:
147147
app.slugger:
148-
class: "%slugger.class%"
148+
class: '%slugger.class%'
149149
150150
This practice is cumbersome and completely unnecessary for your own services:
151151

best_practices/controllers.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ configuration to the main routing configuration file:
4343
4444
# app/config/routing.yml
4545
app:
46-
resource: "@AppBundle/Controller/"
46+
resource: '@AppBundle/Controller/'
4747
type: annotation
4848
4949
This configuration will load annotations from any controller stored inside the

book/configuration.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ format you prefer:
2121
- { resource: security.yml }
2222
2323
framework:
24-
secret: "%secret%"
25-
router: { resource: "%kernel.root_dir%/config/routing.yml" }
24+
secret: '%secret%'
25+
router: { resource: '%kernel.root_dir%/config/routing.yml' }
2626
# ...
2727
2828
# Twig Configuration
2929
twig:
30-
debug: "%kernel.debug%"
31-
strict_variables: "%kernel.debug%"
30+
debug: '%kernel.debug%'
31+
strict_variables: '%kernel.debug%'
3232
3333
# ...
3434
@@ -226,7 +226,7 @@ the configuration file for the ``dev`` environment.
226226
- { resource: config.yml }
227227
228228
framework:
229-
router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
229+
router: { resource: '%kernel.root_dir%/config/routing_dev.yml' }
230230
profiler: { only_exceptions: false }
231231
232232
# ...

book/doctrine.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ information. By convention, this information is usually configured in an
6464
# app/config/config.yml
6565
doctrine:
6666
dbal:
67-
driver: "%database_driver%"
68-
host: "%database_host%"
69-
dbname: "%database_name%"
70-
user: "%database_user%"
71-
password: "%database_password%"
67+
driver: '%database_driver%'
68+
host: '%database_host%'
69+
dbname: '%database_name%'
70+
user: '%database_user%'
71+
password: '%database_password%'
7272
7373
.. code-block:: xml
7474
@@ -162,7 +162,7 @@ for you:
162162
doctrine:
163163
dbal:
164164
driver: pdo_sqlite
165-
path: "%kernel.root_dir%/sqlite.db"
165+
path: '%kernel.root_dir%/sqlite.db'
166166
charset: UTF8
167167
168168
.. code-block:: xml

book/forms.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ controller::
244244

245245
$form->handleRequest($request);
246246

247-
if ($form->isValid()) {
247+
if ($form->isSubmitted() && $form->isValid()) {
248248
// ... perform some action, such as saving the task to the database
249249

250250
return $this->redirectToRoute('task_success');
@@ -1978,4 +1978,4 @@ Learn more from the Cookbook
19781978
.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
19791979
.. _`Cross-site request forgery`: http://en.wikipedia.org/wiki/Cross-site_request_forgery
19801980
.. _`view on GitHub`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form
1981-
.. _`2.8 UPGRADE Log`: https://github.com/symfony/symfony/blob/2.8/UPGRADE-2.8.md#form
1981+
.. _`2.8 UPGRADE Log`: https://github.com/symfony/symfony/blob/2.8/UPGRADE-2.8.md#form

book/from_flat_php_to_symfony2.rst

-6
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ the code that prepares the HTML "presentation":
8585

8686
.. code-block:: html+php
8787

88-
<?php
8988
// index.php
9089
$link = mysql_connect('localhost', 'myuser', 'mypassword');
9190
mysql_select_db('blog_db', $link);
@@ -146,7 +145,6 @@ of the application are isolated in a new file called ``model.php``:
146145

147146
.. code-block:: html+php
148147

149-
<?php
150148
// model.php
151149
function open_database_connection()
152150
{
@@ -188,7 +186,6 @@ The controller (``index.php``) is now very simple:
188186

189187
.. code-block:: html+php
190188

191-
<?php
192189
require_once 'model.php';
193190

194191
$posts = get_all_posts();
@@ -280,7 +277,6 @@ page:
280277

281278
.. code-block:: html+php
282279

283-
<?php
284280
require_once 'model.php';
285281

286282
$post = get_post_by_id($_GET['id']);
@@ -361,7 +357,6 @@ on the requested URI:
361357

362358
.. code-block:: html+php
363359

364-
<?php
365360
// index.php
366361

367362
// load and initialize any global libraries
@@ -464,7 +459,6 @@ the HTTP response being returned. Use them to improve the blog:
464459

465460
.. code-block:: html+php
466461

467-
<?php
468462
// index.php
469463
require_once 'vendor/autoload.php';
470464

book/http_fundamentals.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ known as HTTP headers. For example, one important HTTP response header is
149149
``Content-Type``. The body of the same resource could be returned in multiple
150150
different formats like HTML, XML, or JSON and the ``Content-Type`` header uses
151151
Internet Media Types like ``text/html`` to tell the client which format is
152-
being returned. A list of common media types can be found on Wikipedia's
153-
`List of common media types`_ article.
152+
being returned. You can see a `list of common media types`_ from IANA.
154153

155154
Many other headers exist, some of which are very powerful. For example, certain
156155
headers can be used to create a powerful caching system.
@@ -578,6 +577,6 @@ sensible defaults. For more advanced users, the sky is the limit.
578577
.. _`Live HTTP Headers`: https://addons.mozilla.org/en-US/firefox/addon/live-http-headers/
579578
.. _`List of HTTP status codes`: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
580579
.. _`List of HTTP header fields`: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
581-
.. _`List of common media types`: https://www.iana.org/assignments/media-types/media-types.xhtml
580+
.. _`list of common media types`: https://www.iana.org/assignments/media-types/media-types.xhtml
582581
.. _`Validator`: https://github.com/symfony/validator
583582
.. _`Swift Mailer`: http://swiftmailer.org/

book/page_creation.rst

+9-10
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ a method inside of it that will be executed when someone goes to ``/lucky/number
3939
// src/AppBundle/Controller/LuckyController.php
4040
namespace AppBundle\Controller;
4141

42-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
4342
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
4443
use Symfony\Component\HttpFoundation\Response;
4544

46-
class LuckyController extends Controller
45+
class LuckyController
4746
{
4847
/**
4948
* @Route("/lucky/number")
@@ -104,7 +103,7 @@ Just add a second method to ``LuckyController``::
104103
// src/AppBundle/Controller/LuckyController.php
105104
// ...
106105

107-
class LuckyController extends Controller
106+
class LuckyController
108107
{
109108
// ...
110109

@@ -137,7 +136,7 @@ You can even shorten this with the handy :class:`Symfony\\Component\\HttpFoundat
137136
// --> don't forget this new use statement
138137
use Symfony\Component\HttpFoundation\JsonResponse;
139138

140-
class LuckyController extends Controller
139+
class LuckyController
141140
{
142141
// ...
143142

@@ -170,7 +169,7 @@ at the end:
170169
// src/AppBundle/Controller/LuckyController.php
171170
// ...
172171
173-
class LuckyController extends Controller
172+
class LuckyController
174173
{
175174
/**
176175
* @Route("/lucky/number/{count}")
@@ -224,7 +223,7 @@ The best part is that you can access this value and use it in your controller::
224223
// src/AppBundle/Controller/LuckyController.php
225224
// ...
226225

227-
class LuckyController extends Controller
226+
class LuckyController
228227
{
229228

230229
/**
@@ -478,14 +477,14 @@ is ``app/config/config.yml``:
478477
# ...
479478
480479
framework:
481-
secret: "%secret%"
480+
secret: '%secret%'
482481
router:
483-
resource: "%kernel.root_dir%/config/routing.yml"
482+
resource: '%kernel.root_dir%/config/routing.yml'
484483
# ...
485484
486485
twig:
487-
debug: "%kernel.debug%"
488-
strict_variables: "%kernel.debug%"
486+
debug: '%kernel.debug%'
487+
strict_variables: '%kernel.debug%'
489488
490489
# ...
491490

book/routing.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ file:
164164
# app/config/config.yml
165165
framework:
166166
# ...
167-
router: { resource: "%kernel.root_dir%/config/routing.yml" }
167+
router: { resource: '%kernel.root_dir%/config/routing.yml' }
168168
169169
.. code-block:: xml
170170
@@ -1257,7 +1257,7 @@ configuration:
12571257
12581258
# app/config/routing.yml
12591259
app:
1260-
resource: "@AppBundle/Controller/"
1260+
resource: '@AppBundle/Controller/'
12611261
type: annotation # required to enable the Annotation reader for this resource
12621262
12631263
.. code-block:: xml
@@ -1308,7 +1308,7 @@ directory are parsed and put into the routing.
13081308
13091309
# app/config/routing.yml
13101310
app:
1311-
resource: "@AcmeOtherBundle/Resources/config/routing.yml"
1311+
resource: '@AcmeOtherBundle/Resources/config/routing.yml'
13121312
13131313
.. code-block:: xml
13141314
@@ -1347,7 +1347,7 @@ suppose you want to prefix all routes in the AppBundle with ``/site`` (e.g.
13471347
13481348
# app/config/routing.yml
13491349
app:
1350-
resource: "@AppBundle/Controller/"
1350+
resource: '@AppBundle/Controller/'
13511351
type: annotation
13521352
prefix: /site
13531353

book/service_container.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ parameter and uses it in the service definition.
225225
226226
# app/config/parameters.yml
227227
parameters:
228-
# This will be parsed as string "@securepass"
229-
mailer_password: "@@securepass"
228+
# This will be parsed as string '@securepass'
229+
mailer_password: '@@securepass'
230230
231231
.. note::
232232

@@ -356,7 +356,7 @@ configuration.
356356
357357
# app/config/config.yml
358358
imports:
359-
- { resource: "@AcmeHelloBundle/Resources/config/services.yml" }
359+
- { resource: '@AcmeHelloBundle/Resources/config/services.yml' }
360360
361361
.. code-block:: xml
362362
@@ -433,7 +433,7 @@ invokes the service container extension inside the FrameworkBundle:
433433
secret: xxxxxxxxxx
434434
form: true
435435
csrf_protection: true
436-
router: { resource: "%kernel.root_dir%/config/routing.yml" }
436+
router: { resource: '%kernel.root_dir%/config/routing.yml' }
437437
# ...
438438
439439
.. code-block:: xml

book/translation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ not empty, add the following:
618618
AppBundle\Entity\Author:
619619
properties:
620620
name:
621-
- NotBlank: { message: "author.name.not_blank" }
621+
- NotBlank: { message: 'author.name.not_blank' }
622622
623623
.. code-block:: xml
624624

book/validation.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ rules). In order to validate an object, simply map one or more constraints
307307
to its class and then pass it to the ``validator`` service.
308308

309309
Behind the scenes, a constraint is simply a PHP object that makes an assertive
310-
statement. In real life, a constraint could be: "The cake must not be burned".
310+
statement. In real life, a constraint could be: 'The cake must not be burned'.
311311
In Symfony, constraints are similar: they are assertions that a condition
312312
is true. Given a value, a constraint will tell you if that value
313313
adheres to the rules of the constraint.
@@ -644,7 +644,7 @@ this method must return ``true``:
644644
AppBundle\Entity\Author:
645645
getters:
646646
passwordLegal:
647-
- "True": { message: "The password cannot match your first name" }
647+
- 'True': { message: 'The password cannot match your first name' }
648648
649649
.. code-block:: xml
650650
@@ -954,8 +954,8 @@ username and the password are different only if all other validation passes
954954
- Strict
955955
getters:
956956
passwordLegal:
957-
- "True":
958-
message: "The password cannot match your username"
957+
- 'True':
958+
message: 'The password cannot match your username'
959959
groups: [Strict]
960960
properties:
961961
username:

components/dependency_injection/advanced.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ service by asking for the ``bar`` service like this::
128128
services:
129129
foo:
130130
class: Example\Foo
131-
bar: "@foo"
131+
bar: '@foo'
132132
133133
Decorating Services
134134
-------------------

components/dependency_injection/parentservices.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ The service config for these classes would look something like this:
6363
newsletter_manager:
6464
class: NewsletterManager
6565
calls:
66-
- [setMailer, ["@my_mailer"]]
67-
- [setEmailFormatter, ["@my_email_formatter"]]
66+
- [setMailer, ['@my_mailer']]
67+
- [setEmailFormatter, ['@my_email_formatter']]
6868
6969
greeting_card_manager:
70-
class: "GreetingCardManager"
70+
class: 'GreetingCardManager'
7171
calls:
72-
- [setMailer, ["@my_mailer"]]
73-
- [setEmailFormatter, ["@my_email_formatter"]]
72+
- [setMailer, ['@my_mailer']]
73+
- [setEmailFormatter, ['@my_email_formatter']]
7474
7575
.. code-block:: xml
7676

components/dependency_injection/types.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Another possibility is just setting public fields of the class directly::
199199
newsletter_manager:
200200
class: NewsletterManager
201201
properties:
202-
mailer: "@my_mailer"
202+
mailer: '@my_mailer'
203203
204204
.. code-block:: xml
205205

components/dom_crawler.rst

-6
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,6 @@ and :phpclass:`DOMNode` objects:
300300

301301
The ``html`` method is new in Symfony 2.3.
302302

303-
.. caution::
304-
305-
Due to an issue in PHP, the ``html()`` method returns wrongly decoded HTML
306-
entities in PHP versions lower than 5.3.6 (for example, it returns ````
307-
instead of ``&bull;``).
308-
309303
Links
310304
~~~~~
311305

components/routing/hostname_pattern.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ instance, if you want to match both ``m.example.com`` and
180180
host: "m.{domain}"
181181
defaults:
182182
_controller: AcmeDemoBundle:Main:mobileHomepage
183-
domain: "%domain%"
183+
domain: '%domain%'
184184
requirements:
185-
domain: "%domain%"
185+
domain: '%domain%'
186186
187187
homepage:
188188
path: /
@@ -243,7 +243,7 @@ You can also set the host option on imported routes:
243243
.. code-block:: yaml
244244
245245
acme_hello:
246-
resource: "@AcmeHelloBundle/Resources/config/routing.yml"
246+
resource: '@AcmeHelloBundle/Resources/config/routing.yml'
247247
host: "hello.example.com"
248248
249249
.. code-block:: xml

0 commit comments

Comments
 (0)