Skip to content

Commit

Permalink
Merge branch '2.4' into 2.5
Browse files Browse the repository at this point in the history
* 2.4:
  Update voters.rst
  [Reference] consistent & complete config examples
  Adding 'attr' option to the Textarea options list
  Fixed minor typos.
  document multiple recipients in XML configs
  Fix documentation for group_sequence_provider

Conflicts:
	reference/constraints/Isbn.rst
  • Loading branch information
weaverryan committed Aug 25, 2014
2 parents 936cb0f + 924851f commit cea3fa6
Show file tree
Hide file tree
Showing 45 changed files with 630 additions and 332 deletions.
2 changes: 1 addition & 1 deletion book/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ provides a sequence of groups to be validated:
# src/Acme/DemoBundle/Resources/config/validation.yml
Acme\DemoBundle\Entity\User:
group_sequence_provider: ~
group_sequence_provider: true
.. code-block:: php-annotations
Expand Down
14 changes: 11 additions & 3 deletions cookbook/logging/monolog_email.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,18 @@ it is broken down.
name="swift"
type="swift_mailer"
from-email="error@example.com"
to-email="error@example.com"
subject="An Error Occurred!"
level="debug"
/>
level="debug">
<monolog:to-email>error@example.com</monolog:to-email>
<!-- or multiple to-email elements -->
<!--
<monolog:to-email>dev1@example.com</monolog:to-email>
<monolog:to-email>dev2@example.com</monolog:to-email>
...
-->
</monolog:handler>
</monolog:config>
</container>
Expand Down
2 changes: 1 addition & 1 deletion cookbook/security/voters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ access, not to grant access.
Creating a custom Voter
-----------------------

To blacklist a user based on its IP, you can use the ``request`` service
To blacklist a user based on its IP, you can use the ``request_stack`` service
and compare the IP address against a set of blacklisted IP addresses:

.. code-block:: php
Expand Down
57 changes: 31 additions & 26 deletions reference/configuration/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -359,32 +359,37 @@ The following block shows all possible configuration keys:
.. code-block:: xml
<!-- xmlns:doctrine="http://symfony.com/schema/dic/doctrine" -->
<!-- xsi:schemaLocation="http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd"> -->
<doctrine:config>
<doctrine:dbal
name="default"
dbname="database"
host="localhost"
port="1234"
user="user"
password="secret"
driver="pdo_mysql"
driver-class="MyNamespace\MyDriverImpl"
path="%kernel.data_dir%/data.sqlite"
memory="true"
unix-socket="/tmp/mysql.sock"
wrapper-class="MyDoctrineDbalConnectionWrapper"
charset="UTF8"
logging="%kernel.debug%"
platform-service="MyOwnDatabasePlatformService"
>
<doctrine:option key="foo">bar</doctrine:option>
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
<doctrine:type name="custom">Acme\HelloBundle\MyCustomType</doctrine:type>
</doctrine:dbal>
</doctrine:config>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
<doctrine:config>
<doctrine:dbal
name="default"
dbname="database"
host="localhost"
port="1234"
user="user"
password="secret"
driver="pdo_mysql"
driver-class="MyNamespace\MyDriverImpl"
path="%kernel.data_dir%/data.sqlite"
memory="true"
unix-socket="/tmp/mysql.sock"
wrapper-class="MyDoctrineDbalConnectionWrapper"
charset="UTF8"
logging="%kernel.debug%"
platform-service="MyOwnDatabasePlatformService">
<doctrine:option key="foo">bar</doctrine:option>
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
<doctrine:type name="custom">Acme\HelloBundle\MyCustomType</doctrine:type>
</doctrine:dbal>
</doctrine:config>
</container>
If you want to configure multiple connections in YAML, put them under the
``connections`` key and give them a unique name:
Expand Down
59 changes: 45 additions & 14 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,26 @@ have installed `PhpStormOpener`_ and use PHPstorm, you will do something like:

.. code-block:: yaml
# app/config/config.yml
framework:
ide: "pstorm://%%f:%%l"
.. code-block:: xml
<?xml version="1.0" charset="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/service"
xmlns:framework="http://symfony.com/schema/dic/symfony">
<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<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">
<framework:config ide="pstorm://%%f:%%l" />
</container>
.. code-block:: php
// app/config/config.php
$container->loadFromExtension('framework', array(
'ide' => 'pstorm://%%f:%%l',
));
Expand Down Expand Up @@ -158,17 +163,26 @@ see :doc:`/cookbook/request/load_balancer_reverse_proxy`.

.. code-block:: yaml
# app/config/config.yml
framework:
trusted_proxies: [192.0.0.1, 10.0.0.0/8]
.. code-block:: xml
<framework:config trusted-proxies="192.0.0.1, 10.0.0.0/8">
<!-- ... -->
</framework>
<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<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">
<framework:config trusted-proxies="192.0.0.1, 10.0.0.0/8" />
</container>
.. code-block:: php
// app/config/config.php
$container->loadFromExtension('framework', array(
'trusted_proxies' => array('192.0.0.1', '10.0.0.0/8'),
));
Expand Down Expand Up @@ -285,9 +299,17 @@ the value to ``null``:
.. code-block:: xml
<!-- app/config/config.xml -->
<framework:config>
<framework:session save-path="null" />
</framework:config>
<?xml version="1.0" encoding="UTF-8" ?>
<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">
<framework:config>
<framework:session save-path="null" />
</framework:config>
</container>
.. code-block:: php
Expand Down Expand Up @@ -373,15 +395,24 @@ Now, activate the ``assets_version`` option:
.. code-block:: xml
<!-- app/config/config.xml -->
<framework:templating assets-version="v2">
<framework:engine id="twig" />
</framework:templating>
<?xml version="1.0" encoding="UTF-8" ?>
<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">
<framework:templating assets-version="v2">
<!-- ... -->
<framework:engine>twig</framework:engine>
</framework:templating>
</container>
.. code-block:: php
// app/config/config.php
$container->loadFromExtension('framework', array(
...,
// ...
'templating' => array(
'engines' => array('twig'),
'assets_version' => 'v2',
Expand Down
52 changes: 29 additions & 23 deletions reference/configuration/swiftmailer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,29 +200,35 @@ Full default Configuration
.. code-block:: xml
<swiftmailer:config
transport="smtp"
username=""
password=""
host="localhost"
port="false"
encryption=""
auth_mode=""
sender_address=""
delivery_address=""
disable_delivery=""
logging="%kernel.debug%"
>
<swiftmailer:spool
path="%kernel.cache_dir%/swiftmailer/spool"
type="file"
/>
<swiftmailer:antiflood
sleep="0"
threshold="99"
/>
</swiftmailer:config>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:swiftmailer="http://symfony.com/schema/dic/swiftmailer"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd">
<swiftmailer:config
transport="smtp"
username=""
password=""
host="localhost"
port="false"
encryption=""
auth_mode=""
sender_address=""
delivery_address=""
disable_delivery=""
logging="%kernel.debug%"
>
<swiftmailer:spool
path="%kernel.cache_dir%/swiftmailer/spool"
type="file" />
<swiftmailer:antiflood
sleep="0"
threshold="99" />
</swiftmailer:config>
</container>
Using multiple Mailers
----------------------
Expand Down
10 changes: 5 additions & 5 deletions reference/constraints/All.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ entry in that array:

.. code-block:: yaml
# src/UserBundle/Resources/config/validation.yml
# src/Acme/UserBundle/Resources/config/validation.yml
Acme\UserBundle\Entity\User:
properties:
favoriteColors:
Expand All @@ -37,15 +37,15 @@ entry in that array:
// src/Acme/UserBundle/Entity/User.php
namespace Acme\UserBundle\Entity;
use Symfony\Component\Validator\Constraints as Assert;
class User
{
/**
* @Assert\All({
* @Assert\NotBlank,
* @Assert\Length(min = "5")
* @Assert\Length(min = 5)
* })
*/
protected $favoriteColors = array();
Expand Down Expand Up @@ -77,7 +77,7 @@ entry in that array:
// src/Acme/UserBundle/Entity/User.php
namespace Acme\UserBundle\Entity;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints as Assert;
Expand Down
2 changes: 1 addition & 1 deletion reference/constraints/Blank.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ of an ``Author`` class were blank, you could do the following:

.. code-block:: yaml
# src/BlogBundle/Resources/config/validation.yml
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author:
properties:
firstName:
Expand Down
15 changes: 8 additions & 7 deletions reference/constraints/Collection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ blank but is no longer than 100 characters in length, you would do the following
* @Assert\NotBlank(),
* @Assert\Length(
* max = 100,
* maxMessage = "Your bio is too long!"
* maxMessage = "Your short bio is too long!"
* )
* }
* },
Expand Down Expand Up @@ -117,7 +117,7 @@ blank but is no longer than 100 characters in length, you would do the following
<constraint name="NotBlank" />
<constraint name="Length">
<option name="max">100</option>
<option name="maxMessage">Your bio is too long!</option>
<option name="maxMessage">Your short bio is too long!</option>
</constraint>
</value>
</option>
Expand Down Expand Up @@ -146,7 +146,10 @@ blank but is no longer than 100 characters in length, you would do the following
'personal_email' => new Assert\Email(),
'lastName' => array(
new Assert\NotBlank(),
new Assert\Length(array("max" => 100)),
new Assert\Length(array(
'max' => 100,
'maxMessage' => 'Your short bio is too long!',
)),
),
),
'allowMissingFields' => true,
Expand Down Expand Up @@ -215,13 +218,11 @@ field is optional but must be a valid email if supplied, you can do the followin
* @Assert\Collection(
* fields={
* "personal_email" = @Assert\Required({@Assert\NotBlank, @Assert\Email}),
* "alternate_email" = @Assert\Optional(@Assert\Email),
* "alternate_email" = @Assert\Optional(@Assert\Email)
* }
* )
*/
protected $profileData = array(
'personal_email',
);
protected $profileData = array('personal_email');
}
.. code-block:: xml
Expand Down
4 changes: 2 additions & 2 deletions reference/constraints/Country.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Basic Usage

.. code-block:: yaml
# src/UserBundle/Resources/config/validation.yml
# src/Acme/UserBundle/Resources/config/validation.yml
Acme\UserBundle\Entity\User:
properties:
country:
Expand All @@ -36,7 +36,7 @@ Basic Usage
class User
{
/**
* @Assert\Country
* @Assert\Country()
*/
protected $country;
}
Expand Down
Loading

0 comments on commit cea3fa6

Please sign in to comment.