Skip to content

Commit a17bdd7

Browse files
committed
Merge branch '2.7'
2 parents ca3b4c8 + 1da9206 commit a17bdd7

18 files changed

+76
-54
lines changed

best_practices/security.rst

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ which uses a login form to load users from the database:
4343

4444
.. code-block:: yaml
4545
46+
# app/config/security.yml
4647
security:
4748
encoders:
4849
AppBundle\Entity\User: bcrypt

book/controller.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Controller
55
==========
66

7-
A controller is a PHP function you create that takes information from the
7+
A controller is a PHP callable you create that takes information from the
88
HTTP request and constructs and returns an HTTP response (as a Symfony
99
``Response`` object). The response could be an HTML page, an XML document,
1010
a serialized JSON array, an image, a redirect, a 404 error or anything else

book/service_container.rst

+32-11
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ straightforward. Parameters make defining services more organized and flexible:
183183
<?xml version="1.0" encoding="UTF-8" ?>
184184
<container xmlns="http://symfony.com/schema/dic/services"
185185
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
186-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
186+
xsi:schemaLocation="http://symfony.com/schema/dic/services
187+
http://symfony.com/schema/dic/services/services-1.0.xsd">
187188
188189
<parameters>
189190
<parameter key="my_mailer.transport">sendmail</parameter>
@@ -317,7 +318,8 @@ directories don't exist, create them.
317318
<?xml version="1.0" encoding="UTF-8" ?>
318319
<container xmlns="http://symfony.com/schema/dic/services"
319320
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
320-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
321+
xsi:schemaLocation="http://symfony.com/schema/dic/services
322+
http://symfony.com/schema/dic/services/services-1.0.xsd">
321323
322324
<parameters>
323325
<parameter key="my_mailer.transport">sendmail</parameter>
@@ -361,7 +363,8 @@ configuration.
361363
<?xml version="1.0" encoding="UTF-8" ?>
362364
<container xmlns="http://symfony.com/schema/dic/services"
363365
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
364-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
366+
xsi:schemaLocation="http://symfony.com/schema/dic/services
367+
http://symfony.com/schema/dic/services/services-1.0.xsd">
365368
366369
<imports>
367370
<import resource="@AcmeHelloBundle/Resources/config/services.xml"/>
@@ -440,8 +443,10 @@ invokes the service container extension inside the FrameworkBundle:
440443
<container xmlns="http://symfony.com/schema/dic/services"
441444
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
442445
xmlns:framework="http://symfony.com/schema/dic/symfony"
443-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
444-
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
446+
xsi:schemaLocation="http://symfony.com/schema/dic/services
447+
http://symfony.com/schema/dic/services/services-1.0.xsd
448+
http://symfony.com/schema/dic/symfony
449+
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
445450
446451
<framework:config secret="xxxxxxxxxx">
447452
<framework:form />
@@ -564,6 +569,7 @@ the service container gives you a much more appealing option:
564569
services:
565570
my_mailer:
566571
# ...
572+
567573
newsletter_manager:
568574
class: Acme\HelloBundle\Newsletter\NewsletterManager
569575
arguments: ["@my_mailer"]
@@ -574,12 +580,14 @@ the service container gives you a much more appealing option:
574580
<?xml version="1.0" encoding="UTF-8" ?>
575581
<container xmlns="http://symfony.com/schema/dic/services"
576582
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
577-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
583+
xsi:schemaLocation="http://symfony.com/schema/dic/services
584+
http://symfony.com/schema/dic/services/services-1.0.xsd">
578585
579586
<services>
580587
<service id="my_mailer">
581588
<!-- ... -->
582589
</service>
590+
583591
<service id="newsletter_manager" class="Acme\HelloBundle\Newsletter\NewsletterManager">
584592
<argument type="service" id="my_mailer"/>
585593
</service>
@@ -593,6 +601,7 @@ the service container gives you a much more appealing option:
593601
use Symfony\Component\DependencyInjection\Reference;
594602
595603
$container->setDefinition('my_mailer', ...);
604+
596605
$container->setDefinition('newsletter_manager', new Definition(
597606
'Acme\HelloBundle\Newsletter\NewsletterManager',
598607
array(new Reference('my_mailer'))
@@ -756,6 +765,7 @@ Injecting the dependency by the setter method just needs a change of syntax:
756765
services:
757766
my_mailer:
758767
# ...
768+
759769
newsletter_manager:
760770
class: Acme\HelloBundle\Newsletter\NewsletterManager
761771
calls:
@@ -767,12 +777,14 @@ Injecting the dependency by the setter method just needs a change of syntax:
767777
<?xml version="1.0" encoding="UTF-8" ?>
768778
<container xmlns="http://symfony.com/schema/dic/services"
769779
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
770-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
780+
xsi:schemaLocation="http://symfony.com/schema/dic/services
781+
http://symfony.com/schema/dic/services/services-1.0.xsd">
771782
772783
<services>
773784
<service id="my_mailer">
774785
<!-- ... -->
775786
</service>
787+
776788
<service id="newsletter_manager" class="Acme\HelloBundle\Newsletter\NewsletterManager">
777789
<call method="setMailer">
778790
<argument type="service" id="my_mailer" />
@@ -788,6 +800,7 @@ Injecting the dependency by the setter method just needs a change of syntax:
788800
use Symfony\Component\DependencyInjection\Reference;
789801
790802
$container->setDefinition('my_mailer', ...);
803+
791804
$container->setDefinition('newsletter_manager', new Definition(
792805
'Acme\HelloBundle\Newsletter\NewsletterManager'
793806
))->addMethodCall('setMailer', array(
@@ -924,12 +937,14 @@ it exists and do nothing if it doesn't:
924937
<?xml version="1.0" encoding="UTF-8" ?>
925938
<container xmlns="http://symfony.com/schema/dic/services"
926939
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
927-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
940+
xsi:schemaLocation="http://symfony.com/schema/dic/services
941+
http://symfony.com/schema/dic/services/services-1.0.xsd">
928942
929943
<services>
930944
<service id="my_mailer">
931945
<!-- ... -->
932946
</service>
947+
933948
<service id="newsletter_manager" class="Acme\HelloBundle\Newsletter\NewsletterManager">
934949
<argument type="service" id="my_mailer" on-invalid="ignore" />
935950
</service>
@@ -944,6 +959,7 @@ it exists and do nothing if it doesn't:
944959
use Symfony\Component\DependencyInjection\ContainerInterface;
945960
946961
$container->setDefinition('my_mailer', ...);
962+
947963
$container->setDefinition('newsletter_manager', new Definition(
948964
'Acme\HelloBundle\Newsletter\NewsletterManager',
949965
array(
@@ -1031,7 +1047,8 @@ Configuring the service container is easy:
10311047
<?xml version="1.0" encoding="UTF-8" ?>
10321048
<container xmlns="http://symfony.com/schema/dic/services"
10331049
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1034-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
1050+
xsi:schemaLocation="http://symfony.com/schema/dic/services
1051+
http://symfony.com/schema/dic/services/services-1.0.xsd">
10351052
10361053
<service id="newsletter_manager" class="Acme\HelloBundle\Newsletter\NewsletterManager">
10371054
<argument type="service" id="mailer"/>
@@ -1080,6 +1097,7 @@ to be used for a specific purpose. Take the following example:
10801097
services:
10811098
foo.twig.extension:
10821099
class: Acme\HelloBundle\Extension\FooExtension
1100+
public: false
10831101
tags:
10841102
- { name: twig.extension }
10851103
@@ -1089,11 +1107,13 @@ to be used for a specific purpose. Take the following example:
10891107
<?xml version="1.0" encoding="UTF-8" ?>
10901108
<container xmlns="http://symfony.com/schema/dic/services"
10911109
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1092-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
1110+
xsi:schemaLocation="http://symfony.com/schema/dic/services
1111+
http://symfony.com/schema/dic/services/services-1.0.xsd">
10931112
10941113
<service
10951114
id="foo.twig.extension"
1096-
class="Acme\HelloBundle\Extension\FooExtension">
1115+
class="Acme\HelloBundle\Extension\FooExtension"
1116+
public="false">
10971117
10981118
<tag name="twig.extension" />
10991119
</service>
@@ -1105,6 +1125,7 @@ to be used for a specific purpose. Take the following example:
11051125
use Symfony\Component\DependencyInjection\Definition;
11061126
11071127
$definition = new Definition('Acme\HelloBundle\Extension\FooExtension');
1128+
$definition->setPublic(false);
11081129
$definition->addTag('twig.extension');
11091130
$container->setDefinition('foo.twig.extension', $definition);
11101131

book/templating.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1189,8 +1189,8 @@ automatically:
11891189

11901190
.. versionadded:: 2.6
11911191
The global ``app.security`` variable (or the ``$app->getSecurity()``
1192-
method in PHP templates) is deprecated as of Symfony 2.6. Use `app.user`
1193-
(`$app->getUser()`) and `is_granted()` (`$view['security']->isGranted()`)
1192+
method in PHP templates) is deprecated as of Symfony 2.6. Use ``app.user``
1193+
(``$app->getUser()``) and ``is_granted()`` (``$view['security']->isGranted()``)
11941194
instead.
11951195

11961196
.. tip::

book/translation.rst

+12-11
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ It will also detect the following translator usages in PHP templates:
704704
705705
$view['translator']->trans("Symfony2 is great");
706706
707-
$view['translator']->trans('Symfony2 is great');
707+
$view['translator']->transChoice('Symfony2 is great', 1);
708708
709709
.. caution::
710710

@@ -739,18 +739,19 @@ And suppose you've already setup some translations for the ``fr`` locale inside
739739
</file>
740740
</xliff>
741741
742+
743+
.. code-block:: yaml
744+
745+
# src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.yml
746+
Symfony2 is great: J'aime Symfony2
747+
742748
.. code-block:: php
743749
744750
// src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.php
745751
return array(
746752
'Symfony2 is great' => 'J\'aime Symfony2',
747753
);
748754
749-
.. code-block:: yaml
750-
751-
# src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.yml
752-
Symfony2 is great: J'aime Symfony2
753-
754755
and for the ``en`` locale:
755756

756757
.. configuration-block::
@@ -770,18 +771,18 @@ and for the ``en`` locale:
770771
</file>
771772
</xliff>
772773
774+
.. code-block:: yaml
775+
776+
# src/Acme/AcmeDemoBundle/Resources/translations/messages.en.yml
777+
Symfony2 is great: Symfony2 is great
778+
773779
.. code-block:: php
774780
775781
// src/Acme/AcmeDemoBundle/Resources/translations/messages.en.php
776782
return array(
777783
'Symfony2 is great' => 'Symfony2 is great',
778784
);
779785
780-
.. code-block:: yaml
781-
782-
# src/Acme/AcmeDemoBundle/Resources/translations/messages.en.yml
783-
Symfony2 is great: Symfony2 is great
784-
785786
To inspect all messages in the ``fr`` locale for the AcmeDemoBundle, run:
786787

787788
.. code-block:: bash

book/validation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -856,10 +856,10 @@ as the third argument to the ``validate()`` method::
856856
// If you're using the new 2.5 validation API (you probably are!)
857857
$errors = $validator->validate($author, null, array('registration'));
858858

859-
// If you're using the old 2.4 validation API
859+
// If you're using the old 2.4 validation API, pass the group names as the second argument
860860
// $errors = $validator->validate($author, array('registration'));
861861

862-
If no groups are specified, all constraints that belong in group ``Default``
862+
If no groups are specified, all constraints that belong to the group ``Default``
863863
will be applied.
864864

865865
Of course, you'll usually work with validation indirectly through the form

components/dependency_injection/_imports-parameters-note.rst.inc

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
<?xml version="1.0" encoding="UTF-8" ?>
1919
<container xmlns="http://symfony.com/schema/dic/services"
2020
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
21+
xsi:schemaLocation="http://symfony.com/schema/dic/services
22+
http://symfony.com/schema/dic/services/services-1.0.xsd">
2223

2324
<imports>
2425
<import resource="%kernel.root_dir%/parameters.yml" />

components/http_foundation/sessions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Quick example::
4646

4747
.. note::
4848

49-
While it is recommended to explicitly start a session, a sessions will actually
49+
While it is recommended to explicitly start a session, a session will actually
5050
start on demand, that is, if any session request is made to read/write session
5151
data.
5252

components/options_resolver.rst

+5-9
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,9 @@ In sub-classes, you can use :method:`Symfony\\Component\\OptionsResolver\\Option
361361
to add additional allowed types without erasing the ones already set.
362362

363363
.. versionadded:: 2.6
364-
Before Symfony 2.6, `setAllowedTypes()` and `addAllowedTypes()` expected
365-
the values to be given as an array mapping option names to allowed types::
366-
367-
$resolver->setAllowedTypes(array('port' => array('null', 'int')));
364+
Before Symfony 2.6, ``setAllowedTypes()`` and ``addAllowedTypes()`` expected
365+
the values to be given as an array mapping option names to allowed types:
366+
``$resolver->setAllowedTypes(array('port' => array('null', 'int')));``
368367

369368
Value Validation
370369
~~~~~~~~~~~~~~~~
@@ -413,12 +412,9 @@ In sub-classes, you can use :method:`Symfony\\Component\\OptionsResolver\\Option
413412
to add additional allowed values without erasing the ones already set.
414413

415414
.. versionadded:: 2.6
416-
Before Symfony 2.6, `setAllowedValues()` and `addAllowedValues()` expected
415+
Before Symfony 2.6, ``setAllowedValues()`` and ``addAllowedValues()`` expected
417416
the values to be given as an array mapping option names to allowed values:
418-
419-
.. code-block:: php
420-
421-
$resolver->setAllowedValues(array('transport' => array('sendmail', 'mail', 'smtp')));
417+
``$resolver->setAllowedValues(array('transport' => array('sendmail', 'mail', 'smtp')));``
422418

423419
Option Normalization
424420
~~~~~~~~~~~~~~~~~~~~

components/templating/helpers/assetshelper.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,4 @@ Custom Packages
134134
---------------
135135

136136
You can create your own package by extending
137-
:class:`Symfony\\Component\\Templating\\Package\\Package`.
137+
:class:`Symfony\\Component\\Templating\\Asset\\Package`.

components/templating/helpers/slotshelper.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Extending Templates
5555

5656
The :method:`Symfony\\Component\\Templating\\PhpEngine::extend` method is called in the
5757
sub-template to set its parent template. Then
58-
:method:`$view['slots']->set() <Symfony\\Component\\Translation\\Helper\\SlotsHelper::set>`
58+
:method:`$view['slots']->set() <Symfony\\Component\\Templating\\Helper\\SlotsHelper::set>`
5959
can be used to set the content of a slot. All content which is not explicitly
6060
set in a slot is in the ``_content`` slot.
6161

cookbook/configuration/pdo_session_storage.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ a second array argument to ``PdoSessionHandler``:
150150

151151
The following things can be configured:
152152

153-
* ``db_table``: (default ``session``) The name of the session table in your
153+
* ``db_table``: (default ``sessions``) The name of the session table in your
154154
database;
155155
* ``db_id_col``: (default ``sess_id``) The name of the id column in your
156156
session table (VARCHAR(128));
@@ -229,7 +229,7 @@ following (MySQL):
229229

230230
.. code-block:: sql
231231
232-
CREATE TABLE `session` (
232+
CREATE TABLE `sessions` (
233233
`sess_id` VARBINARY(128) NOT NULL PRIMARY KEY,
234234
`sess_data` BLOB NOT NULL,
235235
`sess_time` INTEGER UNSIGNED NOT NULL,
@@ -243,7 +243,7 @@ For PostgreSQL, the statement should look like this:
243243

244244
.. code-block:: sql
245245
246-
CREATE TABLE session (
246+
CREATE TABLE sessions (
247247
sess_id VARCHAR(128) NOT NULL PRIMARY KEY,
248248
sess_data BYTEA NOT NULL,
249249
sess_time INTEGER NOT NULL,
@@ -257,7 +257,7 @@ For MSSQL, the statement might look like the following:
257257

258258
.. code-block:: sql
259259
260-
CREATE TABLE [dbo].[session](
260+
CREATE TABLE [dbo].[sessions](
261261
[sess_id] [nvarchar](255) NOT NULL,
262262
[sess_data] [ntext] NOT NULL,
263263
[sess_time] [int] NOT NULL,

cookbook/deployment/platformsh.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ command that you see on the Platform.sh web UI):
144144
``PROJECT-ID``
145145
Unique identifier of your project. Something like ``kjh43kbobssae``
146146
``CLUSTER``
147-
Server location where your project is deplyed. It can be ``eu`` or ``us``
147+
Server location where your project is deployed. It can be ``eu`` or ``us``
148148

149149
Commit the Platform.sh specific files created in the previous section:
150150

cookbook/email/email.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ an email is pretty straightforward::
103103

104104
public function indexAction($name)
105105
{
106-
$message = \Swift_Message::newInstance()
106+
$mailer = $this->get('mailer');
107+
$message = $mailer->createMessage()
107108
->setSubject('Hello Email')
108109
->setFrom('[email protected]')
109110
->setTo('[email protected]')
@@ -114,7 +115,7 @@ an email is pretty straightforward::
114115
)
115116
)
116117
;
117-
$this->get('mailer')->send($message);
118+
$mailer->send($message);
118119

119120
return $this->render(...);
120121
}

0 commit comments

Comments
 (0)