Skip to content

Commit

Permalink
Merge branch '2.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Jan 16, 2015
2 parents ca3b4c8 + 1da9206 commit a17bdd7
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 54 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
4 changes: 2 additions & 2 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1189,8 +1189,8 @@ automatically:

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

.. tip::
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/http_foundation/sessions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Quick example::

.. note::

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

Expand Down
14 changes: 5 additions & 9 deletions components/options_resolver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,9 @@ In sub-classes, you can use :method:`Symfony\\Component\\OptionsResolver\\Option
to add additional allowed types without erasing the ones already set.

.. versionadded:: 2.6
Before Symfony 2.6, `setAllowedTypes()` and `addAllowedTypes()` expected
the values to be given as an array mapping option names to allowed types::

$resolver->setAllowedTypes(array('port' => array('null', 'int')));
Before Symfony 2.6, ``setAllowedTypes()`` and ``addAllowedTypes()`` expected
the values to be given as an array mapping option names to allowed types:
``$resolver->setAllowedTypes(array('port' => array('null', 'int')));``

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

.. versionadded:: 2.6
Before Symfony 2.6, `setAllowedValues()` and `addAllowedValues()` expected
Before Symfony 2.6, ``setAllowedValues()`` and ``addAllowedValues()`` expected
the values to be given as an array mapping option names to allowed values:

.. code-block:: php
$resolver->setAllowedValues(array('transport' => array('sendmail', 'mail', 'smtp')));
``$resolver->setAllowedValues(array('transport' => array('sendmail', 'mail', 'smtp')));``

Option Normalization
~~~~~~~~~~~~~~~~~~~~
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
8 changes: 4 additions & 4 deletions cookbook/configuration/pdo_session_storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ a second array argument to ``PdoSessionHandler``:

The following things can be configured:

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

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

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

.. code-block:: sql
CREATE TABLE [dbo].[session](
CREATE TABLE [dbo].[sessions](
[sess_id] [nvarchar](255) NOT NULL,
[sess_data] [ntext] NOT NULL,
[sess_time] [int] NOT NULL,
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('send@example.com')
->setTo('recipient@example.com')
Expand All @@ -114,7 +115,7 @@ an email is pretty straightforward::
)
)
;
$this->get('mailer')->send($message);
$mailer->send($message);

return $this->render(...);
}
Expand Down
Loading

0 comments on commit a17bdd7

Please sign in to comment.