Skip to content

Commit

Permalink
Merge branch '2.7'
Browse files Browse the repository at this point in the history
* 2.7:
  separate table columns with two spaces
  consistent table headlines
  • Loading branch information
weaverryan committed Nov 13, 2014
2 parents 0d5cb0d + ad4c1f0 commit 0c92fab
Show file tree
Hide file tree
Showing 39 changed files with 189 additions and 215 deletions.
18 changes: 9 additions & 9 deletions best_practices/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ But for the templates used in your application, it's much more convenient
to store them in the ``app/Resources/views/`` directory. For starters, this
drastically simplifies their logical names:

================================================== ==================================
Templates stored inside bundles Templates stored in ``app/``
================================================== ==================================
``AcmeDemoBundle:Default:index.html.twig`` ``default/index.html.twig``
``::layout.html.twig`` ``layout.html.twig``
``AcmeDemoBundle::index.html.twig`` ``index.html.twig``
``AcmeDemoBundle:Default:subdir/index.html.twig`` ``default/subdir/index.html.twig``
``AcmeDemoBundle:Default/subdir:index.html.twig`` ``default/subdir/index.html.twig``
================================================== ==================================
================================================= ==================================
Templates Stored inside Bundles Templates Stored in ``app/``
================================================= ==================================
``AcmeDemoBundle:Default:index.html.twig`` ``default/index.html.twig``
``::layout.html.twig`` ``layout.html.twig``
``AcmeDemoBundle::index.html.twig`` ``index.html.twig``
``AcmeDemoBundle:Default:subdir/index.html.twig`` ``default/subdir/index.html.twig``
``AcmeDemoBundle:Default/subdir:index.html.twig`` ``default/subdir/index.html.twig``
================================================= ==================================

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
Expand Down
69 changes: 33 additions & 36 deletions book/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -518,13 +518,13 @@ longer required. The URL ``/blog`` will match this route and the value of
the ``page`` parameter will be set to ``1``. The URL ``/blog/2`` will also
match, giving the ``page`` parameter a value of ``2``. Perfect.

=========== ===== ==========
URL route parameters
=========== ===== ==========
``/blog`` blog {page} = 1
``/blog/1`` blog {page} = 1
``/blog/2`` blog {page} = 2
=========== ===== ==========
=========== ======== ==================
URL Route Parameters
=========== ======== ==================
``/blog`` ``blog`` ``{page}`` = ``1``
``/blog/1`` ``blog`` ``{page}`` = ``1``
``/blog/2`` ``blog`` ``{page}`` = ``2``
=========== ======== ==================

.. caution::

Expand Down Expand Up @@ -627,13 +627,12 @@ will *never* be matched. Instead, a URL like ``/blog/my-blog-post`` will match
the first route (``blog``) and return a nonsense value of ``my-blog-post``
to the ``{page}`` parameter.

+--------------------+-------+-----------------------+
| URL | route | parameters |
+====================+=======+=======================+
| /blog/2 | blog | {page} = 2 |
+--------------------+-------+-----------------------+
| /blog/my-blog-post | blog | {page} = my-blog-post |
+--------------------+-------+-----------------------+
====================== ======== ===============================
URL Route Parameters
====================== ======== ===============================
``/blog/2`` ``blog`` ``{page}`` = ``2``
``/blog/my-blog-post`` ``blog`` ``{page}`` = ``"my-blog-post"``
====================== ======== ===============================

The answer to the problem is to add route *requirements* or route *conditions*
(see :ref:`book-routing-conditions`). The routes in this example would work
Expand Down Expand Up @@ -707,15 +706,13 @@ is *not* a number).
As a result, a URL like ``/blog/my-blog-post`` will now properly match the
``blog_show`` route.

+----------------------+-----------+-------------------------+
| URL | route | parameters |
+======================+===========+=========================+
| /blog/2 | blog | {page} = 2 |
+----------------------+-----------+-------------------------+
| /blog/my-blog-post | blog_show | {slug} = my-blog-post |
+----------------------+-----------+-------------------------+
| /blog/2-my-blog-post | blog_show | {slug} = 2-my-blog-post |
+----------------------+-----------+-------------------------+
======================== ============= ===============================
URL Route Parameters
======================== ============= ===============================
``/blog/2`` ``blog`` ``{page}`` = ``2``
``/blog/my-blog-post`` ``blog_show`` ``{slug}`` = ``my-blog-post``
``/blog/2-my-blog-post`` ``blog_show`` ``{slug}`` = ``2-my-blog-post``
======================== ============= ===============================

.. sidebar:: Earlier Routes always Win

Expand Down Expand Up @@ -791,14 +788,14 @@ URL:
For incoming requests, the ``{_locale}`` portion of the URL is matched against
the regular expression ``(en|fr)``.

======= ========================
path parameters
======= ========================
``/`` {_locale} = en
``/en`` {_locale} = en
``/fr`` {_locale} = fr
``/es`` *won't match this route*
======= ========================
======= ========================
Path Parameters
======= ========================
``/`` ``{_locale}`` = ``"en"``
``/en`` ``{_locale}`` = ``"en"``
``/fr`` ``{_locale}`` = ``"fr"``
``/es`` *won't match this route*
======= ========================

.. index::
single: Routing; Method requirement
Expand Down Expand Up @@ -1142,11 +1139,11 @@ each separated by a colon:

For example, a ``_controller`` value of ``AppBundle:Blog:show`` means:

========= ================== ==============
Bundle Controller Class Method Name
========= ================== ==============
AppBundle ``BlogController`` ``showAction``
========= ================== ==============
========= ================== ==============
Bundle Controller Class Method Name
========= ================== ==============
AppBundle ``BlogController`` ``showAction``
========= ================== ==============

The controller might look like this::

Expand Down
14 changes: 7 additions & 7 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,13 @@ Template Suffix
Every template name also has two extensions that specify the *format* and
*engine* for that template.

======================== ====== ======
Filename Format Engine
======================== ====== ======
``Blog/index.html.twig`` HTML Twig
``Blog/index.html.php`` HTML PHP
``Blog/index.css.twig`` CSS Twig
======================== ====== ======
======================== ====== ======
Filename Format Engine
======================== ====== ======
``Blog/index.html.twig`` HTML Twig
``Blog/index.html.php`` HTML PHP
``Blog/index.css.twig`` CSS Twig
======================== ====== ======

By default, any Symfony template can be written in either Twig or PHP, and
the last part of the extension (e.g. ``.twig`` or ``.php``) specifies which
Expand Down
19 changes: 8 additions & 11 deletions components/class_loader/class_map_generator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@ manually. For example, imagine a library with the following directory structure:
These files contain the following classes:

=========================== ================
File Class name
=========================== ================
``library/bar/baz/Boo.php`` ``Acme\Bar\Baz``
--------------------------- ----------------
``library/bar/Foo.php`` ``Acme\Bar``
--------------------------- ----------------
``library/foo/bar/Foo.php`` ``Acme\Foo\Bar``
--------------------------- ----------------
``library/foo/Bar.php`` ``Acme\Foo``
=========================== ================
=========================== ================
File Class Name
=========================== ================
``library/bar/baz/Boo.php`` ``Acme\Bar\Baz``
``library/bar/Foo.php`` ``Acme\Bar``
``library/foo/bar/Foo.php`` ``Acme\Foo\Bar``
``library/foo/Bar.php`` ``Acme\Foo``
=========================== ================

To make your life easier, the ClassLoader component comes with a
:class:`Symfony\\Component\\ClassLoader\\ClassMapGenerator` class that makes
Expand Down
102 changes: 44 additions & 58 deletions components/form/form_events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@ The ``FormEvents::PRE_SET_DATA`` event is dispatched at the beginning of the

:ref:`Form Events Information Table<component-form-event-table>`

+-----------------+-----------+
| Data type | Value |
+=================+===========+
| Model data | ``null`` |
+-----------------+-----------+
| Normalized data | ``null`` |
+-----------------+-----------+
| View data | ``null`` |
+-----------------+-----------+
=============== ========
Data Type Value
=============== ========
Model data ``null``
Normalized data ``null``
View data ``null``
=============== ========

.. caution::

Expand Down Expand Up @@ -98,15 +96,13 @@ the form.

:ref:`Form Events Information Table<component-form-event-table>`

+-----------------+------------------------------------------------------+
| Data type | Value |
+=================+======================================================+
| Model data | Model data injected into ``setData()`` |
+-----------------+------------------------------------------------------+
| Normalized data | Model data transformed using a model transformer |
+-----------------+------------------------------------------------------+
| View data | Normalized data transformed using a view transformer |
+-----------------+------------------------------------------------------+
=============== ====================================================
Data Type Value
=============== ====================================================
Model data Model data injected into ``setData()``
Normalized data Model data transformed using a model transformer
View data Normalized data transformed using a view transformer
=============== ====================================================

.. sidebar:: ``FormEvents::POST_SET_DATA`` in the Form component

Expand Down Expand Up @@ -143,15 +139,13 @@ It can be used to:

:ref:`Form Events Information Table<component-form-event-table>`

+-----------------+------------------------------------------+
| Data type | Value |
+=================+==========================================+
| Model data | Same as in ``FormEvents::POST_SET_DATA`` |
+-----------------+------------------------------------------+
| Normalized data | Same as in ``FormEvents::POST_SET_DATA`` |
+-----------------+------------------------------------------+
| View data | Same as in ``FormEvents::POST_SET_DATA`` |
+-----------------+------------------------------------------+
=============== ========================================
Data Type Value
=============== ========================================
Model data Same as in ``FormEvents::POST_SET_DATA``
Normalized data Same as in ``FormEvents::POST_SET_DATA``
View data Same as in ``FormEvents::POST_SET_DATA``
=============== ========================================

.. sidebar:: ``FormEvents::PRE_SUBMIT`` in the Form component

Expand All @@ -173,15 +167,13 @@ It can be used to change data from the normalized representation of the data.

:ref:`Form Events Information Table<component-form-event-table>`

+-----------------+-------------------------------------------------------------------------------------+
| Data type | Value |
+=================+=====================================================================================+
| Model data | Same as in ``FormEvents::POST_SET_DATA`` |
+-----------------+-------------------------------------------------------------------------------------+
| Normalized data | Data from the request reverse-transformed from the request using a view transformer |
+-----------------+-------------------------------------------------------------------------------------+
| View data | Same as in ``FormEvents::POST_SET_DATA`` |
+-----------------+-------------------------------------------------------------------------------------+
=============== ===================================================================================
Data Type Value
=============== ===================================================================================
Model data Same as in ``FormEvents::POST_SET_DATA``
Normalized data Data from the request reverse-transformed from the request using a view transformer
View data Same as in ``FormEvents::POST_SET_DATA``
=============== ===================================================================================

.. caution::

Expand All @@ -205,15 +197,13 @@ It can be used to fetch data after denormalization.

:ref:`Form Events Information Table<component-form-event-table>`

+-----------------+---------------------------------------------------------------+
| Data type | Value |
+=================+===============================================================+
| Model data | Normalized data reverse-transformed using a model transformer |
+-----------------+---------------------------------------------------------------+
| Normalized data | Same as in ``FormEvents::POST_SUBMIT`` |
+-----------------+---------------------------------------------------------------+
| View data | Normalized data transformed using a view transformer |
+-----------------+---------------------------------------------------------------+
=============== =============================================================
Data Type Value
=============== =============================================================
Model data Normalized data reverse-transformed using a model transformer
Normalized data Same as in ``FormEvents::POST_SUBMIT``
View data Normalized data transformed using a view transformer
=============== =============================================================

.. caution::

Expand Down Expand Up @@ -248,19 +238,15 @@ processed.

.. _component-form-event-table:

+------------------------+-------------------------------+------------------+
| Name | ``FormEvents`` Constant | Event's data |
+========================+===============================+==================+
| ``form.pre_set_data`` | ``FormEvents::PRE_SET_DATA`` | Model data |
+------------------------+-------------------------------+------------------+
| ``form.post_set_data`` | ``FormEvents::POST_SET_DATA`` | Model data |
+------------------------+-------------------------------+------------------+
| ``form.pre_bind`` | ``FormEvents::PRE_SUBMIT`` | Request data |
+------------------------+-------------------------------+------------------+
| ``form.bind`` | ``FormEvents::SUBMIT`` | Normalized data |
+------------------------+-------------------------------+------------------+
| ``form.post_bind`` | ``FormEvents::POST_SUBMIT`` | View data |
+------------------------+-------------------------------+------------------+
====================== ============================= ===============
Name ``FormEvents`` Constant Event's Data
====================== ============================= ===============
``form.pre_set_data`` ``FormEvents::PRE_SET_DATA`` Model data
``form.post_set_data`` ``FormEvents::POST_SET_DATA`` Model data
``form.pre_bind`` ``FormEvents::PRE_SUBMIT`` Request data
``form.bind`` ``FormEvents::SUBMIT`` Normalized data
``form.post_bind`` ``FormEvents::POST_SUBMIT`` View data
====================== ============================= ===============

.. versionadded:: 2.3
Before Symfony 2.3, ``FormEvents::PRE_SUBMIT``, ``FormEvents::SUBMIT``
Expand Down
28 changes: 11 additions & 17 deletions components/http_kernel/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -575,23 +575,17 @@ each event has their own event object:

.. _component-http-kernel-event-table:

+-----------------------+----------------------------------+-------------------------------------------------------------------------------------+
| Name | ``KernelEvents`` Constant | Argument passed to the listener |
+=======================+==================================+=====================================================================================+
| kernel.request | ``KernelEvents::REQUEST`` | :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent` |
+-----------------------+----------------------------------+-------------------------------------------------------------------------------------+
| kernel.controller | ``KernelEvents::CONTROLLER`` | :class:`Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent` |
+-----------------------+----------------------------------+-------------------------------------------------------------------------------------+
| kernel.view | ``KernelEvents::VIEW`` | :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent` |
+-----------------------+----------------------------------+-------------------------------------------------------------------------------------+
| kernel.response | ``KernelEvents::RESPONSE`` | :class:`Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent` |
+-----------------------+----------------------------------+-------------------------------------------------------------------------------------+
| kernel.finish_request | ``KernelEvents::FINISH_REQUEST`` | :class:`Symfony\\Component\\HttpKernel\\Event\\FinishRequestEvent` |
+-----------------------+----------------------------------+-------------------------------------------------------------------------------------+
| kernel.terminate | ``KernelEvents::TERMINATE`` | :class:`Symfony\\Component\\HttpKernel\\Event\\PostResponseEvent` |
+-----------------------+----------------------------------+-------------------------------------------------------------------------------------+
| kernel.exception | ``KernelEvents::EXCEPTION`` | :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent` |
+-----------------------+----------------------------------+-------------------------------------------------------------------------------------+
===================== ================================ ===================================================================================
Name ``KernelEvents`` Constant Argument passed to the listener
===================== ================================ ===================================================================================
kernel.request ``KernelEvents::REQUEST`` :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent`
kernel.controller ``KernelEvents::CONTROLLER`` :class:`Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent`
kernel.view ``KernelEvents::VIEW`` :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent`
kernel.response ``KernelEvents::RESPONSE`` :class:`Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent`
kernel.finish_request ``KernelEvents::FINISH_REQUEST`` :class:`Symfony\\Component\\HttpKernel\\Event\\FinishRequestEvent`
kernel.terminate ``KernelEvents::TERMINATE`` :class:`Symfony\\Component\\HttpKernel\\Event\\PostResponseEvent`
kernel.exception ``KernelEvents::EXCEPTION`` :class:`Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent`
===================== ================================ ===================================================================================

.. _http-kernel-working-example:

Expand Down
Loading

0 comments on commit 0c92fab

Please sign in to comment.