Skip to content

Commit

Permalink
Merge branch '2.3' into 2.6
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
weaverryan committed Mar 13, 2015
2 parents 325354e + 1ee04ba commit 0f6a906
Show file tree
Hide file tree
Showing 21 changed files with 809 additions and 547 deletions.
6 changes: 4 additions & 2 deletions best_practices/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ they have nothing to do with the application's behavior. In other words, your
application doesn't care about the location of your database or the credentials
to access to it, as long as the database is correctly configured.

.. _best-practices-canonical-parameters:

Canonical Parameters
~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -101,8 +103,8 @@ to control the number of posts to display on the blog homepage:
parameters:
homepage.num_items: 10
If you ask yourself when the last time was that you changed the value of
*any* option like this, odds are that you *never* have. Creating a configuration
If you've done something like this in the past, it's likely that you've in fact
*never* actually needed to change that value. Creating a configuration
option for a value that you are never going to configure just isn't necessary.
Our recommendation is to define these values as constants in your application.
You could, for example, define a ``NUM_ITEMS`` constant in the ``Post`` entity:
Expand Down
2 changes: 1 addition & 1 deletion best_practices/i18n.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ following ``translator`` configuration option and set your application locale:
# app/config/config.yml
framework:
# ...
translator: { fallback: "%locale%" }
translator: { fallbacks: ["%locale%"] }
# app/config/parameters.yml
parameters:
Expand Down
4 changes: 4 additions & 0 deletions best_practices/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ Another advantage is that centralizing your templates simplifies the work
of your designers. They don't need to look for templates in lots of directories
scattered through lots of bundles.

.. best-practice::

Use lowercased snake_case for directory and template names.

Twig Extensions
---------------

Expand Down
8 changes: 4 additions & 4 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -471,14 +471,14 @@ If you're serving HTML, you'll want to render a template. The ``render()``
method renders a template **and** puts that content into a ``Response``
object for you::

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

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

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

The Symfony templating engine is explained in great detail in the
:doc:`Templating </book/templating>` chapter.
Expand Down
26 changes: 13 additions & 13 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ from inside a controller::
->add('save', 'submit', array('label' => 'Create Task'))
->getForm();

return $this->render('Default/new.html.twig', array(
return $this->render('default/new.html.twig', array(
'form' => $form->createView(),
));
}
Expand Down Expand Up @@ -144,14 +144,14 @@ helper functions:

.. code-block:: html+jinja

{# app/Resources/views/Default/new.html.twig #}
{# app/Resources/views/default/new.html.twig #}
{{ form_start(form) }}
{{ form_widget(form) }}
{{ form_end(form) }}

.. code-block:: html+php

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

.. code-block:: html+jinja

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

.. code-block:: html+php

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

.. code-block:: html+jinja

{# app/Resources/views/Default/new.html.twig #}
{# app/Resources/views/default/new.html.twig #}
{{ form_start(form) }}
{{ form_errors(form) }}

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

.. code-block:: html+php

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

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

.. code-block:: html+jinja

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

.. code-block:: html+php

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

.. code-block:: html+jinja

{# app/Resources/views/Default/new.html.twig #}
{# app/Resources/views/default/new.html.twig #}
{% form_theme form 'form/fields.html.twig' %}

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

.. code-block:: html+php

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion book/from_flat_php_to_symfony2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ for example, the list template written in Twig:

.. code-block:: html+jinja

{# app/Resources/views/Blog/list.html.twig #}
{# app/Resources/views/blog/list.html.twig #}
{% extends "layout.html.twig" %}

{% block title %}List of Posts{% endblock %}
Expand Down
Loading

0 comments on commit 0f6a906

Please sign in to comment.