Skip to content

Commit 84e2495

Browse files
committed
Merge branch '2.7' into 2.8
2 parents 7f05db4 + ec522d9 commit 84e2495

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+501
-480
lines changed

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/_build
2-
/_exts
32
*.pyc

Diff for: best_practices/forms.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ makes them easier to re-use later.
8585

8686
Add buttons in the templates, not in the form classes or the controllers.
8787

88-
Since Symfony 2.5, you can add buttons as fields on your form. This is a nice
88+
Since Symfony 2.3, you can add buttons as fields on your form. This is a nice
8989
way to simplify the template that renders your form. But if you add the buttons
9090
directly in your form class, this would effectively limit the scope of that form:
9191

Diff for: book/doctrine.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,10 @@ covered later), group, etc. For more information, see the official
766766
Querying for Objects Using Doctrine's Query Builder
767767
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
768768

769-
Instead of writing a DQL string, you can alternatively use a helpful object called
770-
the ``QueryBuilder`` to build that string for you::
769+
Instead of writing a DQL string, you can use a helpful object called the
770+
``QueryBuilder`` to build that string for you. This is useful when the actual query
771+
depends on dynamic conditions, as your code soon becomes hard to read with
772+
DQL as you start to concatenate strings::
771773

772774
$repository = $this->getDoctrine()
773775
->getRepository('AppBundle:Product');

Diff for: book/page_creation.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ at the end:
181181
}
182182
183183
// ...
184-
}
184+
}
185185
186186
.. code-block:: yaml
187187
@@ -272,7 +272,7 @@ easy, powerful and actually quite fun.
272272
So far, ``LuckyController`` doesn't extend any base class. The easiest way
273273
to use Twig - or many other tools in Symfony - is to extend Symfony's base
274274
:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller` class::
275-
275+
276276
// src/AppBundle/Controller/LuckyController.php
277277
// ...
278278

@@ -566,9 +566,9 @@ Ok, time to finish mastering the fundamentals by reading these chapters:
566566
* :doc:`/book/routing`
567567
* :doc:`/book/templating`
568568

569-
Then, learn about Symfony's :doc:`service container </book/service_container>`
569+
Then, in the :doc:`Symfony Book </book/index>`, learn about the :doc:`service container </book/service_container>`,
570570
the :doc:`form system </book/forms>`, using :doc:`Doctrine </book/doctrine>`
571-
if you need to query a database and more. in the :doc:`Symfony Book </book/index>`.
571+
(if you need to query a database) and more!
572572

573573
There's also a :doc:`Cookbook </cookbook/index>` *packed* with more advanced
574574
"how to" articles to solve *a lot* of problems.

Diff for: book/templating.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ is a :class:`Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables`
11911191
instance which will give you access to some application specific variables
11921192
automatically:
11931193

1194-
``app.security``
1194+
``app.security`` (deprecated as of 2.6)
11951195
The security context.
11961196
``app.user``
11971197
The current user object.

Diff for: book/testing.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,10 @@ expression or a CSS selector, then use the client to click on it. For example::
196196
$link = $crawler
197197
->filter('a:contains("Greet")') // find all links with the text "Greet"
198198
->eq(1) // select the second link in the list
199-
->link() // and click it
199+
->link()
200200
;
201-
201+
202+
// and click it
202203
$crawler = $client->click($link);
203204

204205
Submitting a form is very similar: select a form button, optionally override

Diff for: components/config/definition.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ All options can be documented using the
295295
method.
296296

297297
The info will be printed as a comment when dumping the configuration tree
298-
with the ``config:dump`` command.
298+
with the ``config:dump-reference`` command.
299299

300300
.. versionadded:: 2.6
301301
Since Symfony 2.6, the info will also be added to the exception message

Diff for: cookbook/form/dynamic_form_modification.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ it with :ref:`dic-tags-form-type`.
395395
<!-- app/config/config.xml -->
396396
<services>
397397
<service id="app.form.friend_message" class="AppBundle\Form\Type\FriendMessageFormType">
398-
<argument type="service" id="security.context" />
398+
<argument type="service" id="security.token_storage" />
399399
<tag name="form.type" alias="friend_message" />
400400
</service>
401401
</services>

Diff for: cookbook/logging/channels_handlers.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ the channel).
1515
.. note::
1616

1717
Each channel corresponds to a logger service (``monolog.logger.XXX``)
18-
in the container (use the ``container:debug`` command to see a full list)
18+
in the container (use the ``debug:container`` command to see a full list)
1919
and those are injected into different services.
2020

2121
.. _logging-channel-handler:

Diff for: reference/constraints/All.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ entry in that array:
2525

2626
.. code-block:: php-annotations
2727
28-
// src/Acme/UserBundle/Entity/User.php
29-
namespace Acme\UserBundle\Entity;
28+
// src/AppBundle/Entity/User.php
29+
namespace AppBundle\Entity;
3030
3131
use Symfony\Component\Validator\Constraints as Assert;
3232
@@ -43,8 +43,8 @@ entry in that array:
4343
4444
.. code-block:: yaml
4545
46-
# src/Acme/UserBundle/Resources/config/validation.yml
47-
Acme\UserBundle\Entity\User:
46+
# src/AppBundle/Resources/config/validation.yml
47+
AppBundle\Entity\User:
4848
properties:
4949
favoriteColors:
5050
- All:
@@ -54,13 +54,13 @@ entry in that array:
5454
5555
.. code-block:: xml
5656
57-
<!-- src/Acme/UserBundle/Resources/config/validation.xml -->
57+
<!-- src/AppBundle/Resources/config/validation.xml -->
5858
<?xml version="1.0" encoding="UTF-8" ?>
5959
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
6060
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6161
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
6262
63-
<class name="Acme\UserBundle\Entity\User">
63+
<class name="AppBundle\Entity\User">
6464
<property name="favoriteColors">
6565
<constraint name="All">
6666
<option name="constraints">
@@ -76,8 +76,8 @@ entry in that array:
7676
7777
.. code-block:: php
7878
79-
// src/Acme/UserBundle/Entity/User.php
80-
namespace Acme\UserBundle\Entity;
79+
// src/AppBundle/Entity/User.php
80+
namespace AppBundle\Entity;
8181
8282
use Symfony\Component\Validator\Mapping\ClassMetadata;
8383
use Symfony\Component\Validator\Constraints as Assert;

Diff for: reference/constraints/Blank.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ of an ``Author`` class were blank, you could do the following:
2727

2828
.. code-block:: php-annotations
2929
30-
// src/Acme/BlogBundle/Entity/Author.php
31-
namespace Acme\BlogBundle\Entity;
30+
// src/AppBundle/Entity/Author.php
31+
namespace AppBundle\Entity;
3232
3333
use Symfony\Component\Validator\Constraints as Assert;
3434
@@ -42,21 +42,21 @@ of an ``Author`` class were blank, you could do the following:
4242
4343
.. code-block:: yaml
4444
45-
# src/Acme/BlogBundle/Resources/config/validation.yml
46-
Acme\BlogBundle\Entity\Author:
45+
# src/AppBundle/Resources/config/validation.yml
46+
AppBundle\Entity\Author:
4747
properties:
4848
firstName:
4949
- Blank: ~
5050
5151
.. code-block:: xml
5252
53-
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
53+
<!-- src/AppBundle/Resources/config/validation.xml -->
5454
<?xml version="1.0" encoding="UTF-8" ?>
5555
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
5656
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5757
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
5858
59-
<class name="Acme\BlogBundle\Entity\Author">
59+
<class name="AppBundle\Entity\Author">
6060
<property name="firstName">
6161
<constraint name="Blank" />
6262
</property>
@@ -65,8 +65,8 @@ of an ``Author`` class were blank, you could do the following:
6565
6666
.. code-block:: php
6767
68-
// src/Acme/BlogBundle/Entity/Author.php
69-
namespace Acme\BlogBundle\Entity;
68+
// src/AppBundle/Entity/Author.php
69+
namespace AppBundle\Entity;
7070
7171
use Symfony\Component\Validator\Mapping\ClassMetadata;
7272
use Symfony\Component\Validator\Constraints as Assert;

Diff for: reference/constraints/Callback.rst

+50-35
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ Configuration
3535

3636
.. code-block:: php-annotations
3737
38-
// src/Acme/BlogBundle/Entity/Author.php
39-
namespace Acme\BlogBundle\Entity;
38+
// src/AppBundle/Entity/Author.php
39+
namespace AppBundle\Entity;
4040
4141
use Symfony\Component\Validator\Constraints as Assert;
4242
use Symfony\Component\Validator\Context\ExecutionContextInterface;
@@ -56,28 +56,28 @@ Configuration
5656
5757
.. code-block:: yaml
5858
59-
# src/Acme/BlogBundle/Resources/config/validation.yml
60-
Acme\BlogBundle\Entity\Author:
59+
# src/AppBundle/Resources/config/validation.yml
60+
AppBundle\Entity\Author:
6161
constraints:
6262
- Callback: [validate]
6363
6464
.. code-block:: xml
6565
66-
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
66+
<!-- src/AppBundle/Resources/config/validation.xml -->
6767
<?xml version="1.0" encoding="UTF-8" ?>
6868
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
6969
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7070
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
7171
72-
<class name="Acme\BlogBundle\Entity\Author">
72+
<class name="AppBundle\Entity\Author">
7373
<constraint name="Callback">validate</constraint>
7474
</class>
7575
</constraint-mapping>
7676
7777
.. code-block:: php
7878
79-
// src/Acme/BlogBundle/Entity/Author.php
80-
namespace Acme\BlogBundle\Entity;
79+
// src/AppBundle/Entity/Author.php
80+
namespace AppBundle\Entity;
8181
8282
use Symfony\Component\Validator\Mapping\ClassMetadata;
8383
use Symfony\Component\Validator\Constraints as Assert;
@@ -185,57 +185,69 @@ You can then use the following configuration to invoke this validator:
185185

186186
.. code-block:: php-annotations
187187
188-
// src/Acme/BlogBundle/Entity/Author.php
188+
// src/AppBundle/Entity/Author.php
189189
namespace Acme\BlogBundle\Entity;
190190
191191
use Symfony\Component\Validator\Constraints as Assert;
192192
193193
/**
194-
* @Assert\Callback({"Vendor\Package\Validator", "validate"})
194+
* @Assert\Callback({"AppBundle\MyStaticValidatorClass", "isAuthorValid"})
195195
*/
196196
class Author
197197
{
198198
}
199199
200200
.. code-block:: yaml
201201
202-
# src/Acme/BlogBundle/Resources/config/validation.yml
203-
Acme\BlogBundle\Entity\Author:
204-
constraints:
205-
- Callback: [Vendor\Package\Validator, validate]
202+
# src/AppBundle/Resources/config/validation.yml
203+
AppBundle\Entity\Author:
204+
constraints:
205+
- Callback:
206+
methods:
207+
- [AppBundle\MyStaticValidatorClass, isAuthorValid]
206208

207209
.. code-block:: xml
208210
209-
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
210-
<?xml version="1.0" encoding="UTF-8" ?>
211-
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
212-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
213-
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
214-
215-
<class name="Acme\BlogBundle\Entity\Author">
216-
<constraint name="Callback">
217-
<value>Vendor\Package\Validator</value>
218-
<value>validate</value>
219-
</constraint>
220-
</class>
221-
</constraint-mapping>
211+
<!-- src/AppBundle/Resources/config/validation.xml -->
212+
<?xml version="1.0" encoding="UTF-8" ?>
213+
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
214+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
215+
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
216+
217+
<class name="AppBundle\Entity\Author">
218+
<constraint name="Callback">
219+
<option name="methods">
220+
<value>
221+
<value>AppBundle\MyStaticValidatorClass</value>
222+
<value>isAuthorValid</value>
223+
</value>
224+
</option>
225+
</constraint>
226+
</class>
227+
</constraint-mapping>
222228

223229
.. code-block:: php
224230
225-
// src/Acme/BlogBundle/Entity/Author.php
226-
namespace Acme\BlogBundle\Entity;
231+
// src/AppBundle/Entity/Author.php
232+
namespace AppBundle\Entity;
227233

228234
use Symfony\Component\Validator\Mapping\ClassMetadata;
229235
use Symfony\Component\Validator\Constraints as Assert;
230236

231237
class Author
232238
{
239+
public $name;
240+
233241
public static function loadValidatorMetadata(ClassMetadata $metadata)
234242
{
235-
$metadata->addConstraint(new Assert\Callback(array(
236-
'Vendor\Package\Validator',
237-
'validate',
238-
)));
243+
$metadata->addConstraint(new Callback(array(
244+
'methods' => array(
245+
array(
246+
'AppBundle\MyStaticValidatorClass',
247+
'isAuthorValid',
248+
),
249+
),
250+
)));
239251
}
240252
}
241253

@@ -250,8 +262,11 @@ You can then use the following configuration to invoke this validator:
250262
When configuring the constraint via PHP, you can also pass a closure to the
251263
constructor of the Callback constraint::
252264

253-
// src/Acme/BlogBundle/Entity/Author.php
254-
namespace Acme\BlogBundle\Entity;
265+
// src/AppBundle/Entity/Author.php
266+
namespace AppBundle\Entity;
267+
268+
use Symfony\Component\Validator\ExecutionContextInterface;
269+
use AppBundle\Entity\Author;
255270

256271
use Symfony\Component\Validator\Mapping\ClassMetadata;
257272
use Symfony\Component\Validator\Constraints as Assert;

0 commit comments

Comments
 (0)