Skip to content

Commit 0f6a906

Browse files
committed
Merge branch '2.3' into 2.6
* 2.3: (23 commits) Update configuration.rst Update configuration.rst Readability [#4875] Minor language tweaks [#4779] Minor tweaks to a huge PR Fixed some of the comments [#4793] Very minor tweak that sounds more natural [config][translator] use the new fallbacks option. 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 Made http cache chapter best-practices-compatible and lots of other fixes Made propel chapter best-practices-compatible and lots of other fixes Made testing chapter best-practices-compatible and lots of other fixes Made validation chapter best-practices-compatible Remove usage of first person Updated as per feedback. Updated as per feedback Fix typos ... Conflicts: book/forms.rst book/testing.rst cookbook/logging/monolog.rst reference/configuration/framework.rst
2 parents 325354e + 1ee04ba commit 0f6a906

21 files changed

+809
-547
lines changed

best_practices/configuration.rst

Lines changed: 4 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 13 additions & 13 deletions
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
)) ?>
@@ -784,7 +784,7 @@ of code. Of course, you'll usually need much more flexibility when rendering:
784784

785785
.. code-block:: html+jinja
786786

787-
{# app/Resources/views/Default/new.html.twig #}
787+
{# app/Resources/views/default/new.html.twig #}
788788
{{ form_start(form) }}
789789
{{ form_errors(form) }}
790790

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

795795
.. code-block:: html+php
796796

797-
<!-- app/Resources/views/Default/newAction.html.php -->
797+
<!-- app/Resources/views/default/newAction.html.php -->
798798
<?php echo $view['form']->start($form) ?>
799799
<?php echo $view['form']->errors($form) ?>
800800

@@ -1002,12 +1002,12 @@ to the ``form()`` or the ``form_start()`` helper:
10021002

10031003
.. code-block:: html+jinja
10041004

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

10081008
.. code-block:: html+php
10091009

1010-
<!-- app/Resources/views/Default/newAction.html.php -->
1010+
<!-- app/Resources/views/default/newAction.html.php -->
10111011
<?php echo $view['form']->start($form, array(
10121012
'action' => $view['router']->generate('target_route'),
10131013
'method' => 'GET',
@@ -1466,7 +1466,7 @@ renders the form:
14661466

14671467
.. code-block:: html+jinja
14681468

1469-
{# app/Resources/views/Default/new.html.twig #}
1469+
{# app/Resources/views/default/new.html.twig #}
14701470
{% form_theme form 'form/fields.html.twig' %}
14711471

14721472
{% form_theme form 'form/fields.html.twig' 'form/fields2.html.twig' %}
@@ -1475,10 +1475,10 @@ renders the form:
14751475

14761476
.. code-block:: html+php
14771477

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

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

14831483
<!-- ... render the form -->
14841484

book/from_flat_php_to_symfony2.rst

Lines changed: 1 addition & 1 deletion
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)