Skip to content

Commit 1da9206

Browse files
committed
Merge branch '2.5' into 2.6
2 parents 5b91653 + 952e317 commit 1da9206

File tree

14 files changed

+64
-38
lines changed

14 files changed

+64
-38
lines changed

best_practices/security.rst

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 32 additions & 11 deletions
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/translation.rst

Lines changed: 12 additions & 11 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 1 deletion
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/templating/helpers/assetshelper.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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/deployment/platformsh.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 2 deletions
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('send@example.com')
109110
->setTo('recipient@example.com')
@@ -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)