Skip to content

Commit

Permalink
Merge branch '2.5' into 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Jan 16, 2015
2 parents 5b91653 + 952e317 commit 1da9206
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 38 deletions.
1 change: 1 addition & 0 deletions best_practices/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ which uses a login form to load users from the database:

.. code-block:: yaml
# app/config/security.yml
security:
encoders:
AppBundle\Entity\User: bcrypt
Expand Down
2 changes: 1 addition & 1 deletion book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Controller
==========

A controller is a PHP function you create that takes information from the
A controller is a PHP callable you create that takes information from the
HTTP request and constructs and returns an HTTP response (as a Symfony
``Response`` object). The response could be an HTML page, an XML document,
a serialized JSON array, an image, a redirect, a 404 error or anything else
Expand Down
43 changes: 32 additions & 11 deletions book/service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ straightforward. Parameters make defining services more organized and flexible:
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="my_mailer.transport">sendmail</parameter>
Expand Down Expand Up @@ -317,7 +318,8 @@ directories don't exist, create them.
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="my_mailer.transport">sendmail</parameter>
Expand Down Expand Up @@ -361,7 +363,8 @@ configuration.
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<imports>
<import resource="@AcmeHelloBundle/Resources/config/services.xml"/>
Expand Down Expand Up @@ -440,8 +443,10 @@ invokes the service container extension inside the FrameworkBundle:
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="xxxxxxxxxx">
<framework:form />
Expand Down Expand Up @@ -564,6 +569,7 @@ the service container gives you a much more appealing option:
services:
my_mailer:
# ...
newsletter_manager:
class: Acme\HelloBundle\Newsletter\NewsletterManager
arguments: ["@my_mailer"]
Expand All @@ -574,12 +580,14 @@ the service container gives you a much more appealing option:
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="my_mailer">
<!-- ... -->
</service>
<service id="newsletter_manager" class="Acme\HelloBundle\Newsletter\NewsletterManager">
<argument type="service" id="my_mailer"/>
</service>
Expand All @@ -593,6 +601,7 @@ the service container gives you a much more appealing option:
use Symfony\Component\DependencyInjection\Reference;
$container->setDefinition('my_mailer', ...);
$container->setDefinition('newsletter_manager', new Definition(
'Acme\HelloBundle\Newsletter\NewsletterManager',
array(new Reference('my_mailer'))
Expand Down Expand Up @@ -756,6 +765,7 @@ Injecting the dependency by the setter method just needs a change of syntax:
services:
my_mailer:
# ...
newsletter_manager:
class: Acme\HelloBundle\Newsletter\NewsletterManager
calls:
Expand All @@ -767,12 +777,14 @@ Injecting the dependency by the setter method just needs a change of syntax:
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="my_mailer">
<!-- ... -->
</service>
<service id="newsletter_manager" class="Acme\HelloBundle\Newsletter\NewsletterManager">
<call method="setMailer">
<argument type="service" id="my_mailer" />
Expand All @@ -788,6 +800,7 @@ Injecting the dependency by the setter method just needs a change of syntax:
use Symfony\Component\DependencyInjection\Reference;
$container->setDefinition('my_mailer', ...);
$container->setDefinition('newsletter_manager', new Definition(
'Acme\HelloBundle\Newsletter\NewsletterManager'
))->addMethodCall('setMailer', array(
Expand Down Expand Up @@ -924,12 +937,14 @@ it exists and do nothing if it doesn't:
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="my_mailer">
<!-- ... -->
</service>
<service id="newsletter_manager" class="Acme\HelloBundle\Newsletter\NewsletterManager">
<argument type="service" id="my_mailer" on-invalid="ignore" />
</service>
Expand All @@ -944,6 +959,7 @@ it exists and do nothing if it doesn't:
use Symfony\Component\DependencyInjection\ContainerInterface;
$container->setDefinition('my_mailer', ...);
$container->setDefinition('newsletter_manager', new Definition(
'Acme\HelloBundle\Newsletter\NewsletterManager',
array(
Expand Down Expand Up @@ -1031,7 +1047,8 @@ Configuring the service container is easy:
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<service id="newsletter_manager" class="Acme\HelloBundle\Newsletter\NewsletterManager">
<argument type="service" id="mailer"/>
Expand Down Expand Up @@ -1080,6 +1097,7 @@ to be used for a specific purpose. Take the following example:
services:
foo.twig.extension:
class: Acme\HelloBundle\Extension\FooExtension
public: false
tags:
- { name: twig.extension }
Expand All @@ -1089,11 +1107,13 @@ to be used for a specific purpose. Take the following example:
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<service
id="foo.twig.extension"
class="Acme\HelloBundle\Extension\FooExtension">
class="Acme\HelloBundle\Extension\FooExtension"
public="false">
<tag name="twig.extension" />
</service>
Expand All @@ -1105,6 +1125,7 @@ to be used for a specific purpose. Take the following example:
use Symfony\Component\DependencyInjection\Definition;
$definition = new Definition('Acme\HelloBundle\Extension\FooExtension');
$definition->setPublic(false);
$definition->addTag('twig.extension');
$container->setDefinition('foo.twig.extension', $definition);
Expand Down
23 changes: 12 additions & 11 deletions book/translation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ It will also detect the following translator usages in PHP templates:
$view['translator']->trans("Symfony2 is great");
$view['translator']->trans('Symfony2 is great');
$view['translator']->transChoice('Symfony2 is great', 1);
.. caution::

Expand Down Expand Up @@ -739,18 +739,19 @@ And suppose you've already setup some translations for the ``fr`` locale inside
</file>
</xliff>
.. code-block:: yaml
# src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.yml
Symfony2 is great: J'aime Symfony2
.. code-block:: php
// src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.php
return array(
'Symfony2 is great' => 'J\'aime Symfony2',
);
.. code-block:: yaml
# src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.yml
Symfony2 is great: J'aime Symfony2
and for the ``en`` locale:

.. configuration-block::
Expand All @@ -770,18 +771,18 @@ and for the ``en`` locale:
</file>
</xliff>
.. code-block:: yaml
# src/Acme/AcmeDemoBundle/Resources/translations/messages.en.yml
Symfony2 is great: Symfony2 is great
.. code-block:: php
// src/Acme/AcmeDemoBundle/Resources/translations/messages.en.php
return array(
'Symfony2 is great' => 'Symfony2 is great',
);
.. code-block:: yaml
# src/Acme/AcmeDemoBundle/Resources/translations/messages.en.yml
Symfony2 is great: Symfony2 is great
To inspect all messages in the ``fr`` locale for the AcmeDemoBundle, run:

.. code-block:: bash
Expand Down
4 changes: 2 additions & 2 deletions book/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -856,10 +856,10 @@ as the third argument to the ``validate()`` method::
// If you're using the new 2.5 validation API (you probably are!)
$errors = $validator->validate($author, null, array('registration'));

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

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

Of course, you'll usually work with validation indirectly through the form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<imports>
<import resource="%kernel.root_dir%/parameters.yml" />
Expand Down
2 changes: 1 addition & 1 deletion components/templating/helpers/assetshelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ Custom Packages
---------------

You can create your own package by extending
:class:`Symfony\\Component\\Templating\\Package\\Package`.
:class:`Symfony\\Component\\Templating\\Asset\\Package`.
2 changes: 1 addition & 1 deletion components/templating/helpers/slotshelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Extending Templates

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

Expand Down
2 changes: 1 addition & 1 deletion cookbook/deployment/platformsh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ command that you see on the Platform.sh web UI):
``PROJECT-ID``
Unique identifier of your project. Something like ``kjh43kbobssae``
``CLUSTER``
Server location where your project is deplyed. It can be ``eu`` or ``us``
Server location where your project is deployed. It can be ``eu`` or ``us``

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

Expand Down
5 changes: 3 additions & 2 deletions cookbook/email/email.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ an email is pretty straightforward::

public function indexAction($name)
{
$message = \Swift_Message::newInstance()
$mailer = $this->get('mailer');
$message = $mailer->createMessage()
->setSubject('Hello Email')
->setFrom('[email protected]')
->setTo('[email protected]')
Expand All @@ -114,7 +115,7 @@ an email is pretty straightforward::
)
)
;
$this->get('mailer')->send($message);
$mailer->send($message);

return $this->render(...);
}
Expand Down
4 changes: 2 additions & 2 deletions cookbook/routing/custom_route_loader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ type you want. The resource name itself is not actually used in the example::
$routes = new RouteCollection();

// prepare a new route
$pattern = '/extra/{parameter}';
$path = '/extra/{parameter}';
$defaults = array(
'_controller' => 'AcmeDemoBundle:Demo:extra',
);
$requirements = array(
'parameter' => '\d+',
);
$route = new Route($pattern, $defaults, $requirements);
$route = new Route($path, $defaults, $requirements);

// add the new route to the route collection:
$routeName = 'extraRoute';
Expand Down
4 changes: 2 additions & 2 deletions cookbook/routing/service_container_parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Sometimes you may find it useful to make some parts of your routes
globally configurable. For instance, if you build an internationalized
site, you'll probably start with one or two locales. Surely you'll
add a requirement to your routes to prevent a user from matching a locale
other than the locales your support.
other than the locales you support.

You *could* hardcode your ``_locale`` requirement in all your routes. But
You *could* hardcode your ``_locale`` requirement in all your routes, but
a better solution is to use a configurable service container parameter right
inside your routing configuration:

Expand Down
4 changes: 2 additions & 2 deletions cookbook/security/form_login_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ see :doc:`/cookbook/security/form_login`.
.. _book-security-common-pitfalls:

Avoid common Pitfalls
=====================
---------------------

When setting up your login form, watch out for a few common pitfalls.

Expand Down Expand Up @@ -471,4 +471,4 @@ any firewall. This means you can't check for security or even access the
user object on these pages. See :doc:`/cookbook/controller/error_pages`
for more details.

.. _`FOSUserBundle`: https://github.com/FriendsOfSymfony/FOSUserBundle
.. _`FOSUserBundle`: https://github.com/FriendsOfSymfony/FOSUserBundle
3 changes: 2 additions & 1 deletion reference/dic_tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ kernel.terminate
+-------------------------------------------------------------------------------------------+----------+
| Listener Class Name | Priority |
+===========================================================================================+==========+
| :class:`Symfony\\Bundle\\SwiftmailerBundle\\EventListener\\EmailSenderListener` | 0 |
| `EmailSenderListener`_ | 0 |
+-------------------------------------------------------------------------------------------+----------+
.. _dic-tags-kernel-event-subscriber:
Expand Down Expand Up @@ -1398,3 +1398,4 @@ For an example, see the ``EntityInitializer`` class inside the Doctrine Bridge.
.. _`KernelEvents`: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/KernelEvents.php
.. _`SwiftMailer's Plugin Documentation`: http://swiftmailer.org/docs/plugins.html
.. _`Twig Loader`: http://twig.sensiolabs.org/doc/api.html#loaders
.. _`EmailSenderListener`: https://github.com/symfony/SwiftmailerBundle/blob/master/EventListener/EmailSenderListener.php

0 comments on commit 1da9206

Please sign in to comment.