Skip to content

Commit 2b87b47

Browse files
committed
Merge branch '2.6' into 2.7
* 2.6: (32 commits) Update configuration.rst Update configuration.rst Readability [#4875] Minor language tweaks [#4779] Minor tweaks to a huge PR [#4724] Minor language tweaks and cross-link to form theming document the validation payload option Fixed some of the comments [#4793] Very minor tweak that sounds more natural [#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form [#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form [config][translator] use the new fallbacks option. add missing reference options and descriptions Linked "logrotate" to its official website Minor rewording Added a note about log file sizes and the use of logrotate Use snake_case for template names Fixed minor grammar issues Made http cache chapter best-practices-compatible and lots of other fixes Made propel chapter best-practices-compatible and lots of other fixes ...
2 parents f8e2e19 + 0f6a906 commit 2b87b47

Some content is hidden

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

70 files changed

+1202
-556
lines changed

best_practices/configuration.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ they have nothing to do with the application's behavior. In other words, your
4242
application doesn't care about the location of your database or the credentials
4343
to access to it, as long as the database is correctly configured.
4444

45+
.. _best-practices-canonical-parameters:
46+
4547
Canonical Parameters
4648
~~~~~~~~~~~~~~~~~~~~
4749

@@ -101,8 +103,8 @@ to control the number of posts to display on the blog homepage:
101103
parameters:
102104
homepage.num_items: 10
103105
104-
If you ask yourself when the last time was that you changed the value of
105-
*any* option like this, odds are that you *never* have. Creating a configuration
106+
If you've done something like this in the past, it's likely that you've in fact
107+
*never* actually needed to change that value. Creating a configuration
106108
option for a value that you are never going to configure just isn't necessary.
107109
Our recommendation is to define these values as constants in your application.
108110
You could, for example, define a ``NUM_ITEMS`` constant in the ``Post`` entity:

best_practices/i18n.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ following ``translator`` configuration option and set your application locale:
1111
# app/config/config.yml
1212
framework:
1313
# ...
14-
translator: { fallback: "%locale%" }
14+
translator: { fallbacks: ["%locale%"] }
1515
1616
# app/config/parameters.yml
1717
parameters:

best_practices/templates.rst

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ Another advantage is that centralizing your templates simplifies the work
5151
of your designers. They don't need to look for templates in lots of directories
5252
scattered through lots of bundles.
5353

54+
.. best-practice::
55+
56+
Use lowercased snake_case for directory and template names.
57+
5458
Twig Extensions
5559
---------------
5660

book/controller.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -471,14 +471,14 @@ If you're serving HTML, you'll want to render a template. The ``render()``
471471
method renders a template **and** puts that content into a ``Response``
472472
object for you::
473473

474-
// renders app/Resources/views/Hello/index.html.twig
475-
return $this->render('Hello/index.html.twig', array('name' => $name));
474+
// renders app/Resources/views/hello/index.html.twig
475+
return $this->render('hello/index.html.twig', array('name' => $name));
476476

477477
You can also put templates in deeper sub-directories. Just try to avoid creating
478478
unnecessarily deep structures::
479479

480-
// renders app/Resources/views/Hello/Greetings/index.html.twig
481-
return $this->render('Hello/Greetings/index.html.twig', array('name' => $name));
480+
// renders app/Resources/views/hello/greetings/index.html.twig
481+
return $this->render('hello/greetings/index.html.twig', array('name' => $name));
482482

483483
The Symfony templating engine is explained in great detail in the
484484
:doc:`Templating </book/templating>` chapter.

book/forms.rst

+15-13
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ from inside a controller::
9696
->add('save', 'submit', array('label' => 'Create Task'))
9797
->getForm();
9898

99-
return $this->render('Default/new.html.twig', array(
99+
return $this->render('default/new.html.twig', array(
100100
'form' => $form->createView(),
101101
));
102102
}
@@ -144,14 +144,14 @@ helper functions:
144144

145145
.. code-block:: html+jinja
146146

147-
{# app/Resources/views/Default/new.html.twig #}
147+
{# app/Resources/views/default/new.html.twig #}
148148
{{ form_start(form) }}
149149
{{ form_widget(form) }}
150150
{{ form_end(form) }}
151151

152152
.. code-block:: html+php
153153

154-
<!-- app/Resources/views/Default/new.html.php -->
154+
<!-- app/Resources/views/default/new.html.php -->
155155
<?php echo $view['form']->start($form) ?>
156156
<?php echo $view['form']->widget($form) ?>
157157
<?php echo $view['form']->end($form) ?>
@@ -442,12 +442,12 @@ corresponding errors printed out with the form.
442442

443443
.. code-block:: html+jinja
444444

445-
{# app/Resources/views/Default/new.html.twig #}
445+
{# app/Resources/views/default/new.html.twig #}
446446
{{ form(form, {'attr': {'novalidate': 'novalidate'}}) }}
447447

448448
.. code-block:: html+php
449449

450-
<!-- app/Resources/views/Default/new.html.php -->
450+
<!-- app/Resources/views/default/new.html.php -->
451451
<?php echo $view['form']->form($form, array(
452452
'attr' => array('novalidate' => 'novalidate'),
453453
)) ?>
@@ -788,7 +788,7 @@ of code. Of course, you'll usually need much more flexibility when rendering:
788788

789789
.. code-block:: html+jinja
790790

791-
{# app/Resources/views/Default/new.html.twig #}
791+
{# app/Resources/views/default/new.html.twig #}
792792
{{ form_start(form) }}
793793
{{ form_errors(form) }}
794794

@@ -798,7 +798,7 @@ of code. Of course, you'll usually need much more flexibility when rendering:
798798

799799
.. code-block:: html+php
800800

801-
<!-- app/Resources/views/Default/newAction.html.php -->
801+
<!-- app/Resources/views/default/newAction.html.php -->
802802
<?php echo $view['form']->start($form) ?>
803803
<?php echo $view['form']->errors($form) ?>
804804

@@ -1006,12 +1006,12 @@ to the ``form()`` or the ``form_start()`` helper:
10061006

10071007
.. code-block:: html+jinja
10081008

1009-
{# app/Resources/views/Default/new.html.twig #}
1009+
{# app/Resources/views/default/new.html.twig #}
10101010
{{ form_start(form, {'action': path('target_route'), 'method': 'GET'}) }}
10111011

10121012
.. code-block:: html+php
10131013

1014-
<!-- app/Resources/views/Default/newAction.html.php -->
1014+
<!-- app/Resources/views/default/newAction.html.php -->
10151015
<?php echo $view['form']->start($form, array(
10161016
'action' => $view['router']->generate('target_route'),
10171017
'method' => 'GET',
@@ -1470,7 +1470,7 @@ renders the form:
14701470

14711471
.. code-block:: html+jinja
14721472

1473-
{# app/Resources/views/Default/new.html.twig #}
1473+
{# app/Resources/views/default/new.html.twig #}
14741474
{% form_theme form 'form/fields.html.twig' %}
14751475

14761476
{% form_theme form 'form/fields.html.twig' 'form/fields2.html.twig' %}
@@ -1479,10 +1479,10 @@ renders the form:
14791479

14801480
.. code-block:: html+php
14811481

1482-
<!-- app/Resources/views/Default/new.html.php -->
1483-
<?php $view['form']->setTheme($form, array('Form')) ?>
1482+
<!-- app/Resources/views/default/new.html.php -->
1483+
<?php $view['form']->setTheme($form, array('form')) ?>
14841484

1485-
<?php $view['form']->setTheme($form, array('Form', 'Form2')) ?>
1485+
<?php $view['form']->setTheme($form, array('form', 'form2')) ?>
14861486

14871487
<!-- ... render the form -->
14881488

@@ -1780,6 +1780,8 @@ The CSRF token can be customized on a form-by-form basis. For example::
17801780
// ...
17811781
}
17821782

1783+
.. _form-disable-csrf:
1784+
17831785
To disable CSRF protection, set the ``csrf_protection`` option to false.
17841786
Customizations can also be made globally in your project. For more information,
17851787
see the :ref:`form configuration reference <reference-framework-form>`

book/from_flat_php_to_symfony2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ for example, the list template written in Twig:
710710

711711
.. code-block:: html+jinja
712712

713-
{# app/Resources/views/Blog/list.html.twig #}
713+
{# app/Resources/views/blog/list.html.twig #}
714714
{% extends "layout.html.twig" %}
715715

716716
{% block title %}List of Posts{% endblock %}

0 commit comments

Comments
 (0)