Skip to content

Commit 03be4a5

Browse files
committed
Merge branch '2.0'
Conflicts: cookbook/form/dynamic_form_generation.rst cookbook/form/form_collections.rst cookbook/form/use_virtuals_forms.rst
2 parents 5ca75eb + 7aa023d commit 03be4a5

File tree

14 files changed

+81
-29
lines changed

14 files changed

+81
-29
lines changed

book/page_creation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ in mind:
984984
* the **configuration** for each bundle lives in the ``Resources/config``
985985
directory of the bundle and can be specified in YAML, XML or PHP;
986986

987-
* the global **application configuration** lives in the ``app/Resources/config``
987+
* the global **application configuration** lives in the ``app/config``
988988
directory;
989989

990990
* each **environment** is accessible via a different front controller (e.g.

book/service_container.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,8 +877,8 @@ the framework.
877877

878878
.. _book-service-container-tags:
879879

880-
Tags (``tags``)
881-
---------------
880+
Tags
881+
----
882882

883883
In the same way that a blog post on the Web might be tagged with things such
884884
as "Symfony" or "PHP", services configured in your container can also be

book/templating.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,11 @@ from the bundle to ``app/Resources/AcmeBlogBundle/views/Blog/index.html.twig``
10661066
(the ``app/Resources/AcmeBlogBundle`` directory won't exist, so you'll need
10671067
to create it). You're now free to customize the template.
10681068

1069+
.. caution::
1070+
1071+
If you add a template in a new location, you *may* need to clear your
1072+
cache (``php app/console cache:clear``), even if you are in debug mode.
1073+
10691074
This logic also applies to base bundle templates. Suppose also that each
10701075
template in ``AcmeBlogBundle`` inherits from a base template called
10711076
``AcmeBlogBundle::layout.html.twig``. Just as before, Symfony2 will look in

book/translation.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ is done just as before:
227227
.. code-block:: yaml
228228
229229
# messages.fr.yml
230-
'Hello %name%': Hello %name%
230+
'Hello %name%': Bonjour %name%
231231
232232
.. note::
233233

@@ -950,7 +950,7 @@ Create a translation file under the ``validators`` catalog for the constraint me
950950

951951
.. code-block:: xml
952952
953-
<!-- validators.fr.xliff -->
953+
<!-- validators.en.xliff -->
954954
<?xml version="1.0"?>
955955
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
956956
<file source-language="en" datatype="plaintext" original="file.ext">
@@ -965,14 +965,14 @@ Create a translation file under the ``validators`` catalog for the constraint me
965965
966966
.. code-block:: php
967967
968-
// validators.fr.php
968+
// validators.en.php
969969
return array(
970970
'author.name.not_blank' => 'Please enter an author name.',
971971
);
972972
973973
.. code-block:: yaml
974974
975-
# validators.fr.yml
975+
# validators.en.yml
976976
author.name.not_blank: Please enter an author name.
977977
978978
Summary

components/console.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ console::
261261

262262
use Symfony\Component\Console\Application;
263263
use Symfony\Component\Console\Tester\CommandTester;
264+
use Acme\DemoBundle\Command\GreetCommand;
264265

265266
class ListCommandTest extends \PHPUnit_Framework_TestCase
266267
{
@@ -287,8 +288,8 @@ You can test sending arguments and options to the command by passing them
287288
as an array to the :method:`Symfony\\Component\\Console\\Tester\\CommandTester::getDisplay`
288289
method::
289290

290-
use Symfony\Component\Console\Tester\CommandTester;
291291
use Symfony\Component\Console\Application;
292+
use Symfony\Component\Console\Tester\CommandTester;
292293
use Acme\DemoBundle\Command\GreetCommand;
293294

294295
class ListCommandTest extends \PHPUnit_Framework_TestCase

cookbook/event_dispatcher/class_extension.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ magic ``__call()`` method in the class you want to be extended like this:
1717
{
1818
// create an event named 'foo.method_is_not_found'
1919
$event = new HandleUndefinedMethodEvent($this, $method, $arguments);
20-
$this->dispatcher->dispatch($this, 'foo.method_is_not_found', $event);
20+
$this->dispatcher->dispatch('foo.method_is_not_found', $event);
2121
2222
// no listener was able to process the event? The method does not exist
2323
if (!$event->isProcessed()) {
@@ -122,4 +122,4 @@ instance of ``Bar`` with the ``foo.method_is_not_found`` event:
122122
.. code-block:: php
123123
124124
$bar = new Bar();
125-
$dispatcher->addListener('foo.method_is_not_found', $bar);
125+
$dispatcher->addListener('foo.method_is_not_found', array($bar, 'onFooMethodIsNotFound'));

cookbook/form/dynamic_form_generation.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ How to Dynamically Generate Forms Using Form Events
77
Before jumping right into dynamic form generation, let's have a quick review
88
of what a bare form class looks like::
99

10-
// src/Acme/DemoBundle/Form/ProductType.php
11-
namespace Acme\DemoBundle\Form;
10+
// src/Acme/DemoBundle/Form/Type/ProductType.php
11+
namespace Acme\DemoBundle\Form\Type;
1212

1313
use Symfony\Component\Form\AbstractType;
1414
use Symfony\Component\Form\FormBuilderInterface;
@@ -53,8 +53,8 @@ So, instead of directly adding that "name" widget via our ProductType form
5353
class, let's delegate the responsibility of creating that particular field
5454
to an Event Subscriber::
5555

56-
// src/Acme/DemoBundle/Form/ProductType.php
57-
namespace Acme\DemoBundle\Form
56+
// src/Acme/DemoBundle/Form/Type/ProductType.php
57+
namespace Acme\DemoBundle\Form\Type;
5858

5959
use Symfony\Component\Form\AbstractType
6060
use Symfony\Component\Form\FormBuilderInterface;

cookbook/form/form_collections.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,12 +603,14 @@ the relationship between the removed ``Tag`` and ``Task`` object.
603603
throw $this->createNotFoundException('No task found for is '.$id);
604604
}
605605

606+
$originalTags = array();
607+
606608
// Create an array of the current Tag objects in the database
607609
foreach ($task->getTags() as $tag) $originalTags[] = $tag;
608610
609611
$editForm = $this->createForm(new TaskType(), $task);
610612

611-
if ('POST' === $request->getMethod()) {
613+
if ('POST' === $request->getMethod()) {
612614
$editForm->bind($this->getRequest());
613615

614616
if ($editForm->isValid()) {

cookbook/form/form_customization.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ your template file rather than adding the template as a resource:
478478

479479
.. code-block:: html+jinja
480480

481-
{% form_theme form 'form_table_layout.html.twig' %}
481+
{% form_theme form 'form_table_layout.html.twig' %}
482482

483483
Note that the ``form`` variable in the above code is the form view variable
484484
that you passed to your template.
@@ -571,7 +571,7 @@ your template file rather than adding the template as a resource:
571571

572572
.. code-block:: html+php
573573

574-
<?php $view['form']->setTheme($form, array('FrameworkBundle:FormTable')); ?>
574+
<?php $view['form']->setTheme($form, array('FrameworkBundle:FormTable')); ?>
575575

576576
Note that the ``$form`` variable in the above code is the form view variable
577577
that you passed to your template.

cookbook/form/use_virtuals_forms.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Look at the result::
142142
}
143143
144144
With the virtual option set to false (default behavior), the Form Component
145-
expect each underlying object to have a ``foo`` (or ``bar``) property that
145+
expects each underlying object to have a ``foo`` (or ``bar``) property that
146146
is either some object or array which contains the four location fields.
147147
Of course, we don't have this object/array in our entities and we don't want it!
148148

cookbook/map.rst.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@
125125
* :doc:`/cookbook/testing/profiling`
126126
* :doc:`/cookbook/testing/doctrine`
127127

128+
* :doc:`/cookbook/validation/index`
129+
130+
* :doc:`/cookbook/validation/custom_constraint`
131+
128132
* :doc:`/cookbook/web_services/index`
129133

130134
* :doc:`/cookbook/web_services/php_soap_extension`

cookbook/validation/custom_constraint.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,31 @@ With this, the validator ``validate()`` method gets an object as its first argum
226226
}
227227
}
228228

229+
Note that a class constraint validator is applied to the class itself, and
230+
not to the property:
231+
232+
.. configuration-block::
233+
234+
.. code-block:: yaml
235+
236+
# src/Acme/BlogBundle/Resources/config/validation.yml
237+
Acme\DemoBundle\Entity\AcmeEntity:
238+
constraints:
239+
- ContainsAlphanumeric
240+
241+
.. code-block:: php-annotations
242+
243+
/**
244+
* @AcmeAssert\ContainsAlphanumeric
245+
*/
246+
class AcmeEntity
247+
{
248+
// ...
249+
}
250+
251+
.. code-block:: xml
252+
253+
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
254+
<class name="Acme\DemoBundle\Entity\AcmeEntity">
255+
<constraint name="ContainsAlphanumeric" />
256+
</class>

reference/configuration/framework.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Configuration
1818
* `secret`_
1919
* `ide`_
2020
* `test`_
21+
* `trust_proxy_headers`_
2122
* `form`_
2223
* enabled
2324
* `csrf_protection`_
@@ -81,6 +82,17 @@ services related to testing your application (e.g. ``test.client``) are loaded.
8182
This setting should be present in your ``test`` environment (usually via
8283
``app/config/config_test.yml``). For more information, see :doc:`/book/testing`.
8384

85+
trust_proxy_headers
86+
~~~~~~~~~~~~~~~~~~~
87+
88+
**type**: ``Boolean``
89+
90+
Configures if HTTP headers (like ``HTTP_X_FORWARDED_FOR``, ``X_FORWARDED_PROTO``, and
91+
``X_FORWARDED_HOST``) are trusted as indication for an SSL connection. By default, it is
92+
set to ``false`` and only SSL_HTTPS connections are indicated as secure.
93+
94+
You should enable this setting if your application is behind a reverse proxy.
95+
8496
.. _reference-framework-form:
8597

8698
form

reference/constraints/Callback.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,6 @@ Setup
4040
- Callback:
4141
methods: [isAuthorValid]
4242
43-
.. code-block:: xml
44-
45-
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
46-
<class name="Acme\BlogBundle\Entity\Author">
47-
<constraint name="Callback">
48-
<option name="methods">
49-
<value>isAuthorValid</value>
50-
</option>
51-
</constraint>
52-
</class>
53-
5443
.. code-block:: php-annotations
5544
5645
// src/Acme/BlogBundle/Entity/Author.php
@@ -63,6 +52,17 @@ Setup
6352
{
6453
}
6554
55+
.. code-block:: xml
56+
57+
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
58+
<class name="Acme\BlogBundle\Entity\Author">
59+
<constraint name="Callback">
60+
<option name="methods">
61+
<value>isAuthorValid</value>
62+
</option>
63+
</constraint>
64+
</class>
65+
6666
The Callback Method
6767
-------------------
6868

0 commit comments

Comments
 (0)