Skip to content

consistent table headlines #4435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
77 changes: 37 additions & 40 deletions book/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ entries? Update the route to have a new ``{page}`` placeholder:
.. code-block:: php-annotations

// src/AppBundle/Controller/BlogController.php

// ...

/**
Expand Down Expand Up @@ -470,7 +470,7 @@ This is done by including it in the ``defaults`` collection:
.. code-block:: php-annotations

// src/AppBundle/Controller/BlogController.php

// ...

/**
Expand Down Expand Up @@ -522,13 +522,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 All @@ -555,7 +555,7 @@ Take a quick look at the routes that have been created so far:
.. code-block:: php-annotations

// src/AppBundle/Controller/BlogController.php

// ...
class BlogController extends Controller
{
Expand Down Expand Up @@ -631,13 +631,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*. The routes in this
example would work perfectly if the ``/blog/{page}`` path *only* matched
Expand Down Expand Up @@ -710,15 +709,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 All @@ -738,7 +735,7 @@ URL:
.. code-block:: php-annotations

// src/AppBundle/Controller/MainController.php

// ...
class MainController extends Controller
{
Expand Down Expand Up @@ -794,14 +791,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 @@ -1065,11 +1062,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 @@ -444,13 +444,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 @@ -140,15 +136,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 @@ -170,15 +164,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 @@ -202,15 +194,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 @@ -242,19 +232,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
Loading