Skip to content

Commit 1c68bc3

Browse files
committed
Merge branch '2.3' into 2.6
Conflicts: book/forms.rst reference/forms/types/options/error_mapping.rst.inc
2 parents c7c6a9d + 5d304d9 commit 1c68bc3

18 files changed

+133
-48
lines changed

book/forms.rst

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ from inside a controller::
7777
// src/AppBundle/Controller/DefaultController.php
7878
namespace AppBundle\Controller;
7979

80-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8180
use AppBundle\Entity\Task;
81+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8282
use Symfony\Component\HttpFoundation\Request;
8383

8484
class DefaultController extends Controller
@@ -542,16 +542,17 @@ This will call the static method ``determineValidationGroups()`` on the
542542
The Form object is passed as an argument to that method (see next example).
543543
You can also define whole logic inline by using a ``Closure``::
544544

545-
use Acme\AcmeBundle\Entity\Client;
545+
use AppBundle\Entity\Client;
546546
use Symfony\Component\Form\FormInterface;
547547
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
548548

549549
// ...
550550
public function setDefaultOptions(OptionsResolverInterface $resolver)
551551
{
552552
$resolver->setDefaults(array(
553-
'validation_groups' => function(FormInterface $form) {
553+
'validation_groups' => function (FormInterface $form) {
554554
$data = $form->getData();
555+
555556
if (Client::TYPE_PERSON == $data->getType()) {
556557
return array('person');
557558
}
@@ -565,16 +566,17 @@ Using the ``validation_groups`` option overrides the default validation
565566
group which is being used. If you want to validate the default constraints
566567
of the entity as well you have to adjust the option as follows::
567568

568-
use Acme\AcmeBundle\Entity\Client;
569+
use AppBundle\Entity\Client;
569570
use Symfony\Component\Form\FormInterface;
570571
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
571572

572573
// ...
573574
public function setDefaultOptions(OptionsResolverInterface $resolver)
574575
{
575576
$resolver->setDefaults(array(
576-
'validation_groups' => function(FormInterface $form) {
577+
'validation_groups' => function (FormInterface $form) {
577578
$data = $form->getData();
579+
578580
if (Client::TYPE_PERSON == $data->getType()) {
579581
return array('Default', 'person');
580582
}
@@ -1048,7 +1050,8 @@ that will house the logic for building the task form::
10481050
$builder
10491051
->add('task')
10501052
->add('dueDate', null, array('widget' => 'single_text'))
1051-
->add('save', 'submit');
1053+
->add('save', 'submit')
1054+
;
10521055
}
10531056

10541057
public function getName()
@@ -1123,7 +1126,8 @@ the choice is ultimately up to you.
11231126
$builder
11241127
->add('task')
11251128
->add('dueDate', null, array('mapped' => false))
1126-
->add('save', 'submit');
1129+
->add('save', 'submit')
1130+
;
11271131
}
11281132

11291133
Additionally, if there are any fields on the form that aren't included in
@@ -1155,7 +1159,7 @@ easy to use in your application.
11551159
11561160
# src/AppBundle/Resources/config/services.yml
11571161
services:
1158-
acme_demo.form.type.task:
1162+
app.form.type.task:
11591163
class: AppBundle\Form\Type\TaskType
11601164
tags:
11611165
- { name: form.type, alias: task }
@@ -1169,10 +1173,7 @@ easy to use in your application.
11691173
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
11701174
11711175
<services>
1172-
<service
1173-
id="acme_demo.form.type.task"
1174-
class="AppBundle\Form\Type\TaskType">
1175-
1176+
<service id="app.form.type.task" class="AppBundle\Form\Type\TaskType">
11761177
<tag name="form.type" alias="task" />
11771178
</service>
11781179
</services>
@@ -1183,7 +1184,7 @@ easy to use in your application.
11831184
// src/AppBundle/Resources/config/services.php
11841185
$container
11851186
->register(
1186-
'acme_demo.form.type.task',
1187+
'app.form.type.task',
11871188
'AppBundle\Form\Type\TaskType'
11881189
)
11891190
->addTag('form.type', array(
@@ -1476,6 +1477,7 @@ renders the form:
14761477
{# app/Resources/views/default/new.html.twig #}
14771478
{% form_theme form 'form/fields.html.twig' %}
14781479

1480+
{# or if you want to use multiple themes #}
14791481
{% form_theme form 'form/fields.html.twig' 'form/fields2.html.twig' %}
14801482

14811483
{# ... render the form #}
@@ -1485,6 +1487,7 @@ renders the form:
14851487
<!-- app/Resources/views/default/new.html.php -->
14861488
<?php $view['form']->setTheme($form, array('form')) ?>
14871489

1490+
<!-- or if you want to use multiple themes -->
14881491
<?php $view['form']->setTheme($form, array('form', 'form2')) ?>
14891492

14901493
<!-- ... render the form -->
@@ -1731,7 +1734,7 @@ file:
17311734
'Form',
17321735
),
17331736
),
1734-
)
1737+
),
17351738
// ...
17361739
));
17371740

book/templating.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Throughout this chapter, template examples will be shown in both Twig and PHP.
135135
web designers everywhere.
136136

137137
Twig can also do things that PHP can't, such as whitespace control,
138-
sandboxing, automatic HTML escaping, manual contextual output escaping,
138+
sandboxing, automatic HTML escaping, manual contextual output escaping,
139139
and the inclusion of custom functions and filters that only affect templates.
140140
Twig contains little features that make writing templates easier and more concise.
141141
Take the following example, which combines a loop with a logical ``if``
@@ -206,8 +206,8 @@ First, build a base layout file:
206206
<div id="sidebar">
207207
{% block sidebar %}
208208
<ul>
209-
<li><a href="/">Home</a></li>
210-
<li><a href="/blog">Blog</a></li>
209+
<li><a href="/">Home</a></li>
210+
<li><a href="/blog">Blog</a></li>
211211
</ul>
212212
{% endblock %}
213213
</div>
@@ -654,7 +654,7 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**):
654654
{# ... #}
655655
<div id="sidebar">
656656
{{ render(controller(
657-
'AcmeArticleBundle:Article:recentArticles',
657+
'AppBundle:Article:recentArticles',
658658
{ 'max': 3 }
659659
)) }}
660660
</div>
@@ -667,7 +667,7 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**):
667667
<div id="sidebar">
668668
<?php echo $view['actions']->render(
669669
new \Symfony\Component\HttpKernel\Controller\ControllerReference(
670-
'AcmeArticleBundle:Article:recentArticles',
670+
'AppBundle:Article:recentArticles',
671671
array('max' => 3)
672672
)
673673
) ?>
@@ -784,7 +784,7 @@ in your application configuration:
784784
// app/config/config.php
785785
$container->loadFromExtension('framework', array(
786786
// ...
787-
'templating' => array(
787+
'templating' => array(
788788
'hinclude_default_template' => array(
789789
'hinclude.html.twig',
790790
),
@@ -808,7 +808,7 @@ any global default template that is defined):
808808
new ControllerReference('...'),
809809
array(
810810
'renderer' => 'hinclude',
811-
'default' => 'default/content.html.twig',
811+
'default' => 'default/content.html.twig',
812812
)
813813
) ?>
814814
@@ -826,7 +826,7 @@ Or you can also specify a string to display as the default content:
826826
new ControllerReference('...'),
827827
array(
828828
'renderer' => 'hinclude',
829-
'default' => 'Loading...',
829+
'default' => 'Loading...',
830830
)
831831
) ?>
832832
@@ -999,13 +999,13 @@ but Symfony provides a more dynamic option via the ``asset`` Twig function:
999999

10001000
<img src="{{ asset('images/logo.png') }}" alt="Symfony!" />
10011001

1002-
<link href="{{ asset('css/blog.css') }}" rel="stylesheet" type="text/css" />
1002+
<link href="{{ asset('css/blog.css') }}" rel="stylesheet" />
10031003

10041004
.. code-block:: html+php
10051005

10061006
<img src="<?php echo $view['assets']->getUrl('images/logo.png') ?>" alt="Symfony!" />
10071007

1008-
<link href="<?php echo $view['assets']->getUrl('css/blog.css') ?>" rel="stylesheet" type="text/css" />
1008+
<link href="<?php echo $view['assets']->getUrl('css/blog.css') ?>" rel="stylesheet" />
10091009

10101010
The ``asset`` function's main purpose is to make your application more portable.
10111011
If your application lives at the root of your host (e.g. http://example.com),
@@ -1177,7 +1177,7 @@ is by default "web").
11771177

11781178
.. code-block:: html+jinja
11791179

1180-
<link href="{{ asset('bundles/acmedemo/css/contact.css') }}" rel="stylesheet" />
1180+
<link href="{{ asset('bundles/acmedemo/css/contact.css') }}" rel="stylesheet" />
11811181

11821182
The end result is a page that includes both the ``main.css`` and ``contact.css``
11831183
stylesheets.
@@ -1402,7 +1402,7 @@ One common way to use inheritance is to use a three-level approach. This
14021402
method works perfectly with the three different types of templates that were just
14031403
covered:
14041404

1405-
* Create a ``app/Resources/views/base.html.twig`` file that contains the main
1405+
* Create an ``app/Resources/views/base.html.twig`` file that contains the main
14061406
layout for your application (like in the previous example). Internally, this
14071407
template is called ``base.html.twig``;
14081408

@@ -1493,7 +1493,7 @@ tag to the screen:
14931493

14941494
.. code-block:: html
14951495

1496-
Hello &lt;script&gt;alert(&#39;helloe&#39;)&lt;/script&gt;
1496+
Hello &lt;script&gt;alert(&#39;hello!&#39;)&lt;/script&gt;
14971497

14981498
The Twig and PHP templating systems approach the problem in different ways.
14991499
If you're using Twig, output escaping is on by default and you're protected.

changelog.rst

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,81 @@ documentation.
1313
Do you also want to participate in the Symfony Documentation? Take a look
1414
at the ":doc:`/contributing/documentation/overview`" article.
1515

16+
May, 2015
17+
---------
18+
19+
New Documentation
20+
~~~~~~~~~~~~~~~~~
21+
22+
* `#4604 <https://github.com/symfony/symfony-docs/pull/4604>`_ Making the channel handler more useful by showing it on the prod environment (weaverryan)
23+
* `#5155 <https://github.com/symfony/symfony-docs/pull/5155>`_ Documented upgrading path for a major version (WouterJ)
24+
* `#5137 <https://github.com/symfony/symfony-docs/pull/5137>`_ Added a note about the rotating_file monolog handler (javiereguiluz)
25+
* `#5283 <https://github.com/symfony/symfony-docs/pull/5283>`_ [BestPractices] restructured text format for the installation instructions template (xabbuh)
26+
* `#5298 <https://github.com/symfony/symfony-docs/pull/5298>`_ Completed framework config (WouterJ)
27+
* `#5216 <https://github.com/symfony/symfony-docs/pull/5216>`_ [Cookbook] [Deployment] Added note about Nginx (phansys)
28+
* `#5117 <https://github.com/symfony/symfony-docs/pull/5117>`_ Complete review of the "Customize Error Pages" cookbook article (javiereguiluz)
29+
* `#5115 <https://github.com/symfony/symfony-docs/pull/5115>`_ Flesh out twig-template for custom data-collector (Darien Hager)
30+
* `#4728 <https://github.com/symfony/symfony-docs/pull/4728>`_ Add Session Cache Limiting section for NativeSessionStorage (mrclay)
31+
* `#5294 <https://github.com/symfony/symfony-docs/pull/5294>`_ Tweaks to bower entry - specifically committing deps (weaverryan)
32+
* `#5062 <https://github.com/symfony/symfony-docs/pull/5062>`_ Cookbook about Command in Application with AnsiToHtml (Rvanlaak)
33+
* `#4901 <https://github.com/symfony/symfony-docs/pull/4901>`_ Removed the Internals chapter from the Symfony book (javiereguiluz)
34+
* `#4790 <https://github.com/symfony/symfony-docs/pull/4790>`_ [Cookbook][Routing] Update custom_route_loader.rst (xelaris)
35+
* `#5159 <https://github.com/symfony/symfony-docs/pull/5159>`_ Added an article explaining how to use Bower in Symfony (WouterJ)
36+
* `#4700 <https://github.com/symfony/symfony-docs/pull/4700>`_ add informations how to create a custom doctrine mapping (timglabisch)
37+
* `#5164 <https://github.com/symfony/symfony-docs/pull/5164>`_ Added information about the Symfony Demo application (javiereguiluz)
38+
* `#5100 <https://github.com/symfony/symfony-docs/pull/5100>`_ Change MySQL UTF-8 examples to use utf8mb4 (DHager, Darien Hager)
39+
* `#5088 <https://github.com/symfony/symfony-docs/pull/5088>`_ [Cookbook] Custom compile steps on Heroku (bicpi)
40+
41+
Fixed Documentation
42+
~~~~~~~~~~~~~~~~~~~
43+
44+
* `#5324 <https://github.com/symfony/symfony-docs/pull/5324>`_ 5259 improve 'Testing Documentation' in contributing guide (snoek09)
45+
* `#5251 <https://github.com/symfony/symfony-docs/pull/5251>`_ [Cookbook][Controller] replace docs for removed `forward()` method (xabbuh)
46+
* `#5299 <https://github.com/symfony/symfony-docs/pull/5299>`_ Command controller tweaks to #5062 (weaverryan)
47+
* `#5297 <https://github.com/symfony/symfony-docs/pull/5297>`_ Kernel Events Proofreading after #4901 (weaverryan)
48+
* `#5296 <https://github.com/symfony/symfony-docs/pull/5296>`_ Fix link to Zend Soap (peterkokot)
49+
* `#5266 <https://github.com/symfony/symfony-docs/pull/5266>`_ Update heroku.rst (nickbyfleet)
50+
* `#5271 <https://github.com/symfony/symfony-docs/pull/5271>`_ Fix nonexistent controller method (amansilla)
51+
* `#4615 <https://github.com/symfony/symfony-docs/pull/4615>`_ Update NotBlank to reflect the actual validation (DRvanR)
52+
* `#5249 <https://github.com/symfony/symfony-docs/pull/5249>`_ [security][form login] fix translations for the security messages. (aitboudad)
53+
* `#5220 <https://github.com/symfony/symfony-docs/pull/5220>`_ Fix example namespace (lepiaf)
54+
* `#5203 <https://github.com/symfony/symfony-docs/pull/5203>`_ Order has one param without spaces (carlosbuenosvinos)
55+
56+
Minor Documentation Changes
57+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
58+
59+
* `#5343 <https://github.com/symfony/symfony-docs/pull/5343>`_ [Reference][Forms] reorder index to match the description order (xabbuh)
60+
* `#5309 <https://github.com/symfony/symfony-docs/pull/5309>`_ [Cookbook][Controller] few tweaks to the error pages article (xabbuh)
61+
* `#5311 <https://github.com/symfony/symfony-docs/pull/5311>`_ Moved sections to be equal to index list (WouterJ)
62+
* `#5326 <https://github.com/symfony/symfony-docs/pull/5326>`_ Fixed code intentation (lyrixx)
63+
* `#5327 <https://github.com/symfony/symfony-docs/pull/5327>`_ [Platform] Made things more obvious and copy/paste friendly (lyrixx)
64+
* `#5338 <https://github.com/symfony/symfony-docs/pull/5338>`_ Text in index.html.twig for The Big Picture wrong (BT643)
65+
* `#5341 <https://github.com/symfony/symfony-docs/pull/5341>`_ fixed typo and added additional hit for NullOutput() (kuldipem)
66+
* `#5302 <https://github.com/symfony/symfony-docs/pull/5302>`_ Place DQL in front of QueryBuilder (alfonsomga)
67+
* `#5304 <https://github.com/symfony/symfony-docs/pull/5304>`_ Proofreading Javier's excellent updates - in some places, shortening some things (weaverryan)
68+
* `#5263 <https://github.com/symfony/symfony-docs/pull/5263>`_ Let docbot review the form docs (WouterJ)
69+
* `#5280 <https://github.com/symfony/symfony-docs/pull/5280>`_ Rebase #4633 (seangallavan)
70+
* `#5241 <https://github.com/symfony/symfony-docs/pull/5241>`_ [Components][Form] apply some fixes to the Form events chapter (xabbuh)
71+
* `#5233 <https://github.com/symfony/symfony-docs/pull/5233>`_ Improve Choice Validation Constraint Example (huebs)
72+
* `#5228 <https://github.com/symfony/symfony-docs/pull/5228>`_ Clarify `query_builder` closure return type (kix)
73+
* `#5165 <https://github.com/symfony/symfony-docs/pull/5165>`_ Minor changes to match the Symfony Demo reference application (javiereguiluz)
74+
* `#5281 <https://github.com/symfony/symfony-docs/pull/5281>`_ store templates under app/Resources/views (xabbuh)
75+
* `#5267 <https://github.com/symfony/symfony-docs/pull/5267>`_ fix infinity upper bound (xabbuh)
76+
* `#5277 <https://github.com/symfony/symfony-docs/pull/5277>`_ always refer to getcomposer.org through HTTPS (xabbuh)
77+
* `#4671 <https://github.com/symfony/symfony-docs/pull/4671>`_ consistent spelling (xabbuh)
78+
* `#4255 <https://github.com/symfony/symfony-docs/pull/4255>`_ Updated autoload standard to PSR-4. (phansys)
79+
* `#5262 <https://github.com/symfony/symfony-docs/pull/5262>`_ Update Routes in the Getting Started documentation (BT643)
80+
* `#5229 <https://github.com/symfony/symfony-docs/pull/5229>`_ Remove mention of \*.class parameters from conventions (jvasseur)
81+
* `#5250 <https://github.com/symfony/symfony-docs/pull/5250>`_ [Cookbook][Logging] use straightforward instead of straigt forward (xabbuh)
82+
* `#5257 <https://github.com/symfony/symfony-docs/pull/5257>`_ Let docbot review the constraint docs (WouterJ)
83+
* `#5222 <https://github.com/symfony/symfony-docs/pull/5222>`_ Update service_container.rst (assoum891)
84+
* `#5221 <https://github.com/symfony/symfony-docs/pull/5221>`_ Update Uglifyjs.rst (assoum891)
85+
* `#5219 <https://github.com/symfony/symfony-docs/pull/5219>`_ Fix contradicting merging policy rules (lscholten)
86+
* `#5226 <https://github.com/symfony/symfony-docs/pull/5226>`_ Update http_cache.rst (assoum891)
87+
* `#5238 <https://github.com/symfony/symfony-docs/pull/5238>`_ Fixed typo and removed outdated imports (nomack84)
88+
* `#5240 <https://github.com/symfony/symfony-docs/pull/5240>`_ [Cookbook][Email] revert #4808 (xabbuh)
89+
90+
1691
April, 2015
1792
-----------
1893

components/dependency_injection/lazy_services.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ the `ProxyManager bridge`_:
3939

4040
.. code-block:: bash
4141
42-
$ php composer.phar require ocramius/proxy-manager:~0.5
42+
$ php composer.phar require ocramius/proxy-manager:~1.0
4343
4444
Afterwards compile your container and check to make sure that you get
4545
a proxy for your lazy services.

components/finder.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ And it also works with user-defined streams::
111111
use Symfony\Component\Finder\Finder;
112112

113113
$s3 = new \Zend_Service_Amazon_S3($key, $secret);
114-
$s3->registerStreamWrapper("s3");
114+
$s3->registerStreamWrapper('s3');
115115

116116
$finder = new Finder();
117117
$finder->name('photos*')->size('< 100K')->date('since 1 hour ago');

components/form/introduction.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ above snippet and make sure that nobody except your web server can access
138138
the secret.
139139

140140
Internally, this extension will automatically add a hidden field to every
141-
form (called ``__token`` by default) whose value is automatically generated
141+
form (called ``_token`` by default) whose value is automatically generated
142142
and validated when binding the form.
143143

144144
.. tip::
@@ -480,11 +480,11 @@ helper functions:
480480

481481
.. code-block:: html+jinja
482482

483-
<form action="#" method="post" {{ form_enctype(form) }}>
483+
{{ form_start(form) }}
484484
{{ form_widget(form) }}
485485

486486
<input type="submit" />
487-
</form>
487+
{{ form_end(form) }}
488488

489489
.. image:: /images/book/form-simple.png
490490
:align: center

cookbook/controller/error_pages.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ is used to render a Twig template to show the user.
4646

4747
.. _cookbook-error-pages-by-status-code:
4848

49-
This controller uses the HTTP status code, request format and the following
49+
This controller uses the HTTP status code, the request format and the following
5050
logic to determine the template filename:
5151

5252
#. Look for a template for the given format and status code (like ``error404.json.twig``
@@ -79,7 +79,7 @@ A typical project that returns HTML and JSON pages, might look like this:
7979
├─ error.html.twig # All other HTML errors (including 500)
8080
├─ error404.json.twig
8181
├─ error403.json.twig
82-
─ error.json.twig # All other JSON errors (including 500)
82+
─ error.json.twig # All other JSON errors (including 500)
8383
8484
Example 404 Error Template
8585
--------------------------

cookbook/form/dynamic_form_modification.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ To suppress form validation you can use the ``POST_SUBMIT`` event and prevent
713713
the :class:`Symfony\\Component\\Form\\Extension\\Validator\\EventListener\\ValidationListener`
714714
from being called.
715715

716-
The reason for needing to do this is that even if you set ``group_validation``
716+
The reason for needing to do this is that even if you set ``validation_groups``
717717
to ``false`` there are still some integrity checks executed. For example
718718
an uploaded file will still be checked to see if it is too large and the form
719719
will still check to see if non-existing fields were submitted. To disable

0 commit comments

Comments
 (0)