From 79bf0a141b94da051103f6a4236cb72ebd13fb5c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 2 Jun 2014 18:36:27 +0200 Subject: [PATCH 01/16] Misc. minor fixes mostly related to formatting issues --- book/doctrine.rst | 8 +-- book/http_cache.rst | 2 +- book/routing.rst | 4 +- book/templating.rst | 22 +++--- cookbook/configuration/environments.rst | 20 +++--- .../web_server_configuration.rst | 12 ++-- cookbook/form/data_transformers.rst | 70 +++++++++---------- 7 files changed, 71 insertions(+), 67 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index 880bff8a54f..3e823bfe8a4 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -413,12 +413,12 @@ doesn't replace your existing methods). With the ``doctrine:generate:entities`` command you can: - * generate getters and setters; + * generate getters and setters; - * generate repository classes configured with the - ``@ORM\Entity(repositoryClass="...")`` annotation; + * generate repository classes configured with the + ``@ORM\Entity(repositoryClass="...")`` annotation; - * generate the appropriate constructor for 1:n and n:m relations. + * generate the appropriate constructor for 1:n and n:m relations. The ``doctrine:generate:entities`` command saves a backup of the original ``Product.php`` named ``Product.php~``. In some cases, the presence of diff --git a/book/http_cache.rst b/book/http_cache.rst index ea40f66ee08..c9cfcf47980 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -1034,7 +1034,7 @@ Cache Invalidation ------------------ "There are only two hard things in Computer Science: cache invalidation - and naming things." --Phil Karlton + and naming things." — Phil Karlton You should never need to invalidate cached data because invalidation is already taken into account natively in the HTTP cache models. If you use validation, diff --git a/book/routing.rst b/book/routing.rst index 3d05d462d6a..b7681081632 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -850,7 +850,9 @@ uses a simple string pattern called the *logical controller name*, which Symfony maps to a specific PHP method and class. The pattern has three parts, each separated by a colon: - **bundle**:**controller**:**action** +.. code-block:: text + + bundle:controller:action For example, a ``_controller`` value of ``AcmeBlogBundle:Blog:show`` means: diff --git a/book/templating.rst b/book/templating.rst index fb411144ab2..17fee4b3d81 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -75,7 +75,7 @@ to web designers and, in several ways, more powerful than PHP templates: -Twig defines two types of special syntax: +Twig defines three types of special syntax: * ``{{ ... }}``: "Says something": prints a variable or the result of an expression to the template; @@ -83,11 +83,9 @@ Twig defines two types of special syntax: * ``{% ... %}``: "Does something": a **tag** that controls the logic of the template; it is used to execute statements such as for-loops for example. -.. note:: - - There is a third syntax used for creating comments: ``{# this is a comment #}``. - This syntax can be used across multiple lines like the PHP-equivalent - ``/* comment */`` syntax. +* ``{# ... #}``: "Comment something": it's the equivalent of the PHP + ``/* comment */`` syntax. It's used to add single or multi-line comments. + The content of the comments isn't included in the rendered pages. Twig also contains **filters**, which modify content before being rendered. The following makes the ``title`` variable all uppercase before rendering @@ -399,14 +397,14 @@ lives in a specific location: template for a specific page. The three parts of the string, each separated by a colon (``:``), mean the following: - * ``AcmeBlogBundle``: (*bundle*) the template lives inside the - ``AcmeBlogBundle`` (e.g. ``src/Acme/BlogBundle``); + * ``AcmeBlogBundle``: (*bundle*) the template lives inside the + ``AcmeBlogBundle`` (e.g. ``src/Acme/BlogBundle``); - * ``Blog``: (*controller*) indicates that the template lives inside the - ``Blog`` subdirectory of ``Resources/views``; + * ``Blog``: (*controller*) indicates that the template lives inside the + ``Blog`` subdirectory of ``Resources/views``; - * ``index.html.twig``: (*template*) the actual name of the file is - ``index.html.twig``. + * ``index.html.twig``: (*template*) the actual name of the file is + ``index.html.twig``. Assuming that the ``AcmeBlogBundle`` lives at ``src/Acme/BlogBundle``, the final path to the layout would be ``src/Acme/BlogBundle/Resources/views/Blog/index.html.twig``. diff --git a/cookbook/configuration/environments.rst b/cookbook/configuration/environments.rst index 7b68bb7b744..0efc79da058 100644 --- a/cookbook/configuration/environments.rst +++ b/cookbook/configuration/environments.rst @@ -287,12 +287,12 @@ The new environment is now accessible via:: .. note:: - Some environments, like the ``dev`` environment, are never meant to be - accessed on any deployed server by the general public. This is because - certain environments, for debugging purposes, may give too much information - about the application or underlying infrastructure. To be sure these environments - aren't accessible, the front controller is usually protected from external - IP addresses via the following code at the top of the controller: + Some environments, like the ``dev`` environment, are never meant to be + accessed on any deployed server by the general public. This is because + certain environments, for debugging purposes, may give too much information + about the application or underlying infrastructure. To be sure these environments + aren't accessible, the front controller is usually protected from external + IP addresses via the following code at the top of the controller: .. code-block:: php @@ -315,8 +315,12 @@ However, each environment caches its own set of files: .. code-block:: text - app/cache/dev - cache directory for the *dev* environment - app/cache/prod - cache directory for the *prod* environment + / + ├─ app/ + │ ├─ cache/ + │ │ ├─ dev/ // cache directory for the *dev* environment + │ │ └─ prod/ // cache directory for the *prod* environment + │ ├─ ... Sometimes, when debugging, it may be helpful to inspect a cached file to understand how something is working. When doing so, remember to look in diff --git a/cookbook/configuration/web_server_configuration.rst b/cookbook/configuration/web_server_configuration.rst index 717f030ef66..5fbe75f6923 100644 --- a/cookbook/configuration/web_server_configuration.rst +++ b/cookbook/configuration/web_server_configuration.rst @@ -55,13 +55,13 @@ following configuration snippet: In Apache 2.4, ``Order allow,deny`` has been replaced by ``Require all granted``, and hence you need to modify your ``Directory`` permission settings as follows: - .. code-block:: apache + .. code-block:: apache - - # enable the .htaccess rewrites - AllowOverride All - Require all granted - + + # enable the .htaccess rewrites + AllowOverride All + Require all granted + Nginx ----- diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index f8b3942737f..3192092ca5c 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -109,49 +109,49 @@ Using the Transformer Now that you have the transformer built, you just need to add it to your issue field in some form. - You can also use transformers without creating a new custom form type - by calling ``addModelTransformer`` (or ``addViewTransformer`` - see - `Model and View Transformers`_) on any field builder:: +You can also use transformers without creating a new custom form type +by calling ``addModelTransformer`` (or ``addViewTransformer`` - see +`Model and View Transformers`_) on any field builder:: - use Symfony\Component\Form\FormBuilderInterface; - use Acme\TaskBundle\Form\DataTransformer\IssueToNumberTransformer; + use Symfony\Component\Form\FormBuilderInterface; + use Acme\TaskBundle\Form\DataTransformer\IssueToNumberTransformer; - class TaskType extends AbstractType + class TaskType extends AbstractType + { + public function buildForm(FormBuilderInterface $builder, array $options) { - public function buildForm(FormBuilderInterface $builder, array $options) - { - // ... - - // this assumes that the entity manager was passed in as an option - $entityManager = $options['em']; - $transformer = new IssueToNumberTransformer($entityManager); - - // add a normal text field, but add your transformer to it - $builder->add( - $builder->create('issue', 'text') - ->addModelTransformer($transformer) - ); - } + // ... - public function setDefaultOptions(OptionsResolverInterface $resolver) - { - $resolver - ->setDefaults(array( - 'data_class' => 'Acme\TaskBundle\Entity\Task', - )) - ->setRequired(array( - 'em', - )) - ->setAllowedTypes(array( - 'em' => 'Doctrine\Common\Persistence\ObjectManager', - )); - - // ... - } + // this assumes that the entity manager was passed in as an option + $entityManager = $options['em']; + $transformer = new IssueToNumberTransformer($entityManager); + + // add a normal text field, but add your transformer to it + $builder->add( + $builder->create('issue', 'text') + ->addModelTransformer($transformer) + ); + } + + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver + ->setDefaults(array( + 'data_class' => 'Acme\TaskBundle\Entity\Task', + )) + ->setRequired(array( + 'em', + )) + ->setAllowedTypes(array( + 'em' => 'Doctrine\Common\Persistence\ObjectManager', + )); // ... } + // ... + } + This example requires that you pass in the entity manager as an option when creating your form. Later, you'll learn how you could create a custom ``issue`` field type to avoid needing to do this in your controller:: From 00b3d2628807e6e1173444b94e648dd90bf77b16 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 2 Jun 2014 22:38:31 +0200 Subject: [PATCH 02/16] Added the suggestions made by the great @WouterJ --- book/http_cache.rst | 2 +- book/routing.rst | 4 +--- cookbook/configuration/environments.rst | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/book/http_cache.rst b/book/http_cache.rst index c9cfcf47980..e30bd40c7b7 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -1034,7 +1034,7 @@ Cache Invalidation ------------------ "There are only two hard things in Computer Science: cache invalidation - and naming things." — Phil Karlton + and naming things." -- Phil Karlton You should never need to invalidate cached data because invalidation is already taken into account natively in the HTTP cache models. If you use validation, diff --git a/book/routing.rst b/book/routing.rst index b7681081632..3d05d462d6a 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -850,9 +850,7 @@ uses a simple string pattern called the *logical controller name*, which Symfony maps to a specific PHP method and class. The pattern has three parts, each separated by a colon: -.. code-block:: text - - bundle:controller:action + **bundle**:**controller**:**action** For example, a ``_controller`` value of ``AcmeBlogBundle:Blog:show`` means: diff --git a/cookbook/configuration/environments.rst b/cookbook/configuration/environments.rst index 0efc79da058..6360350e2cc 100644 --- a/cookbook/configuration/environments.rst +++ b/cookbook/configuration/environments.rst @@ -318,8 +318,8 @@ However, each environment caches its own set of files: / ├─ app/ │ ├─ cache/ - │ │ ├─ dev/ // cache directory for the *dev* environment - │ │ └─ prod/ // cache directory for the *prod* environment + │ │ ├─ dev/ # cache directory for the *dev* environment + │ │ └─ prod/ # cache directory for the *prod* environment │ ├─ ... Sometimes, when debugging, it may be helpful to inspect a cached file to From dee3180782a5bf415b2ec59ab7beebf61ce9dcd3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 2 Jun 2014 22:42:43 +0200 Subject: [PATCH 03/16] Fixed the formating of one table (it now uses proper headers) --- book/security.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/security.rst b/book/security.rst index b63abe37d11..d13839c8540 100644 --- a/book/security.rst +++ b/book/security.rst @@ -847,8 +847,8 @@ if ``ip``, ``host`` or ``method`` are not specified for an entry, that ``access_ will match any ``ip``, ``host`` or ``method``: +-----------------+-------------+-------------+------------+--------------------------------+-------------------------------------------------------------+ -| **URI** | **IP** | **HOST** | **METHOD** | ``access_control`` | Why? | -+-----------------+-------------+-------------+------------+--------------------------------+-------------------------------------------------------------+ +| URI | IP | HOST | METHOD | ``access_control`` | Why? | ++=================+=============+=============+============+================================+=============================================================+ | ``/admin/user`` | 127.0.0.1 | example.com | GET | rule #1 (``ROLE_USER_IP``) | The URI matches ``path`` and the IP matches ``ip``. | +-----------------+-------------+-------------+------------+--------------------------------+-------------------------------------------------------------+ | ``/admin/user`` | 127.0.0.1 | symfony.com | GET | rule #1 (``ROLE_USER_IP``) | The ``path`` and ``ip`` still match. This would also match | From 0554cae7f403e78991a24a9f3a774c285de47189 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 3 Jun 2014 12:12:40 +0200 Subject: [PATCH 04/16] Fixed some minor formatting issues related to lists --- components/http_foundation/session_configuration.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index ca1332cfaa1..3237cbad424 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -37,7 +37,7 @@ activate these in the same way as it does for custom handlers. Symfony2 provides drivers for the following native save handler as an example: - * :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler` +* :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler` Example usage:: @@ -71,11 +71,11 @@ various points in the session workflow. Symfony2 HttpFoundation provides some by default and these can easily serve as examples if you wish to write your own. - * :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler` - * :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler` - * :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler` - * :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MongoDbSessionHandler` - * :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NullSessionHandler` +* :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler` +* :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler` +* :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler` +* :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MongoDbSessionHandler` +* :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NullSessionHandler` Example usage:: From 4641c66b38c21654e94c5bee32f01f6d1b36fc87 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 3 Jun 2014 12:14:54 +0200 Subject: [PATCH 05/16] Fixed the formatting of one table headers --- components/http_kernel/introduction.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index b1528695ccd..23eab799e7b 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -570,8 +570,8 @@ each event has their own event object: .. _component-http-kernel-event-table: +-------------------+-------------------------------+-------------------------------------------------------------------------------------+ -| **Name** | ``KernelEvents`` **Constant** | **Argument passed to the listener** | -+-------------------+-------------------------------+-------------------------------------------------------------------------------------+ +| 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` | From 9a715778c5aa4e68d2e093215eba6614216f5d63 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 3 Jun 2014 12:46:34 +0200 Subject: [PATCH 06/16] Removed a tip inside a sidebar Adding a tip inside a short sidebar isn't very normal. Moreover it doesn't look right on the website. --- components/routing/hostname_pattern.rst | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index cb6fca05851..0ba38a687cb 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -179,13 +179,9 @@ instance, if you want to match both ``m.example.com`` and .. sidebar:: Using Service Parameters You can also use service parameters if you do not want to hardcode the - hostname: - - .. tip:: - - Make sure you also include a default option for the ``domain`` placeholder, - otherwise you need to include a domain value each time you generate - a URL using the route. + hostname. Make sure you also include a default option for the ``domain`` + placeholder, otherwise you need to include a domain value each time you + generate a URL using the route. .. configuration-block:: From 314c131ec3b8b40f0792a302b58f448359a9d1ed Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 3 Jun 2014 12:48:00 +0200 Subject: [PATCH 07/16] Fixed the indentation of one code block --- components/routing/hostname_pattern.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index 0ba38a687cb..505fce547b1 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -287,10 +287,10 @@ past url matching in your functional tests. .. code-block:: php - $crawler = $client->request( - 'GET', - '/homepage', - array(), - array(), - array('HTTP_HOST' => 'm.' . $client->getContainer()->getParameter('domain')) - ); + $crawler = $client->request( + 'GET', + '/homepage', + array(), + array(), + array('HTTP_HOST' => 'm.' . $client->getContainer()->getParameter('domain')) + ); From 81fe6667e24b8e5ac3570250c9047bf01c3eb56d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 3 Jun 2014 16:16:11 +0200 Subject: [PATCH 08/16] Fixed more table headers formatting --- reference/dic_tags.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 0fbed08d7d8..d975a79c728 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -14,7 +14,7 @@ may also be tags in other bundles you use that aren't listed here. +-----------------------------------+---------------------------------------------------------------------------+ | Tag Name | Usage | -+-----------------------------------+---------------------------------------------------------------------------+ ++===================================+===========================================================================+ | `assetic.asset`_ | Register an asset to the current asset manager | +-----------------------------------+---------------------------------------------------------------------------+ | `assetic.factory_worker`_ | Add a factory worker | @@ -473,7 +473,7 @@ Core Cache Warmers +-------------------------------------------------------------------------------------------+-----------+ | Cache Warmer Class Name | Priority | -+-------------------------------------------------------------------------------------------+-----------+ ++===========================================================================================+===========+ | :class:`Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\TemplatePathsCacheWarmer` | 20 | +-------------------------------------------------------------------------------------------+-----------+ | :class:`Symfony\\Bundle\\FrameworkBundle\\CacheWarmer\\RouterCacheWarmer` | 0 | @@ -514,7 +514,7 @@ kernel.request +-------------------------------------------------------------------------------------------+-----------+ | Listener Class Name | Priority | -+-------------------------------------------------------------------------------------------+-----------+ ++===========================================================================================+===========+ | :class:`Symfony\\Component\\HttpKernel\\EventListener\\ProfilerListener` | 1024 | +-------------------------------------------------------------------------------------------+-----------+ | :class:`Symfony\\Bundle\\FrameworkBundle\\EventListener\\TestSessionListener` | 192 | @@ -533,7 +533,7 @@ kernel.controller +-------------------------------------------------------------------------------------------+----------+ | Listener Class Name | Priority | -+-------------------------------------------------------------------------------------------+----------+ ++===========================================================================================+==========+ | :class:`Symfony\\Bundle\\FrameworkBundle\\DataCollector\\RequestDataCollector` | 0 | +-------------------------------------------------------------------------------------------+----------+ @@ -542,7 +542,7 @@ kernel.response +-------------------------------------------------------------------------------------------+----------+ | Listener Class Name | Priority | -+-------------------------------------------------------------------------------------------+----------+ ++===========================================================================================+==========+ | :class:`Symfony\\Component\\HttpKernel\\EventListener\\EsiListener` | 0 | +-------------------------------------------------------------------------------------------+----------+ | :class:`Symfony\\Component\\HttpKernel\\EventListener\\ResponseListener` | 0 | @@ -563,7 +563,7 @@ kernel.exception +-------------------------------------------------------------------------------------------+----------+ | Listener Class Name | Priority | -+-------------------------------------------------------------------------------------------+----------+ ++===========================================================================================+==========+ | :class:`Symfony\\Component\\HttpKernel\\EventListener\\ProfilerListener` | 0 | +-------------------------------------------------------------------------------------------+----------+ | :class:`Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener` | -128 | @@ -574,7 +574,7 @@ kernel.terminate +-------------------------------------------------------------------------------------------+----------+ | Listener Class Name | Priority | -+-------------------------------------------------------------------------------------------+----------+ ++===========================================================================================+==========+ | :class:`Symfony\\Bundle\\SwiftmailerBundle\\EventListener\\EmailSenderListener` | 0 | +-------------------------------------------------------------------------------------------+----------+ From 6625ff28d7fdd8eedcb4b6c74018702064d49e7e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 3 Jun 2014 17:52:53 +0200 Subject: [PATCH 09/16] Fixed the indentation of a bulleted list --- contributing/code/patches.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/contributing/code/patches.rst b/contributing/code/patches.rst index aa9037d2c56..1967c8dc0f0 100644 --- a/contributing/code/patches.rst +++ b/contributing/code/patches.rst @@ -310,23 +310,23 @@ translation files, use the shorter version of the check-list: Some answers to the questions trigger some more requirements: - * If you answer yes to "Bug fix?", check if the bug is already listed in the - Symfony issues and reference it/them in "Fixed tickets"; +* If you answer yes to "Bug fix?", check if the bug is already listed in the + Symfony issues and reference it/them in "Fixed tickets"; - * If you answer yes to "New feature?", you must submit a pull request to the - documentation and reference it under the "Doc PR" section; +* If you answer yes to "New feature?", you must submit a pull request to the + documentation and reference it under the "Doc PR" section; - * If you answer yes to "BC breaks?", the patch must contain updates to the - relevant ``CHANGELOG`` and ``UPGRADE`` files; +* If you answer yes to "BC breaks?", the patch must contain updates to the + relevant ``CHANGELOG`` and ``UPGRADE`` files; - * If you answer yes to "Deprecations?", the patch must contain updates to the - relevant ``CHANGELOG`` and ``UPGRADE`` files; +* If you answer yes to "Deprecations?", the patch must contain updates to the + relevant ``CHANGELOG`` and ``UPGRADE`` files; - * If you answer no to "Tests pass", you must add an item to a todo-list with - the actions that must be done to fix the tests; +* If you answer no to "Tests pass", you must add an item to a todo-list with + the actions that must be done to fix the tests; - * If the "license" is not MIT, just don't submit the pull request as it won't - be accepted anyway. +* If the "license" is not MIT, just don't submit the pull request as it won't + be accepted anyway. If some of the previous requirements are not met, create a todo-list and add relevant items: From 2deb5d76d3c8a9a82d1911debf97d1388de1aaed Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 4 Jun 2014 22:05:10 +0200 Subject: [PATCH 10/16] Added some links to API methods --- cookbook/security/entity_provider.rst | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 3ae31907877..efe3a0f4592 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -190,11 +190,11 @@ security layer, the entity class must implement the :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface`. This interface forces the class to implement the five following methods: -* ``getRoles()``, -* ``getPassword()``, -* ``getSalt()``, -* ``getUsername()``, -* ``eraseCredentials()`` +* :method:`Symfony\\Component\\Security\\Core\\User\\UserInterface::getRoles` +* :method:`Symfony\\Component\\Security\\Core\\User\\UserInterface::getPassword` +* :method:`Symfony\\Component\\Security\\Core\\User\\UserInterface::getSalt` +* :method:`Symfony\\Component\\Security\\Core\\User\\UserInterface::getUsername` +* :method:`Symfony\\Component\\Security\\Core\\User\\UserInterface::eraseCredential` For more details on each of these, see :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface`. @@ -377,11 +377,14 @@ entity class to benefit from simple and advanced authentication behaviors. The :class:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface` interface adds four extra methods to validate the account status: -* ``isAccountNonExpired()`` checks whether the user's account has expired, -* ``isAccountNonLocked()`` checks whether the user is locked, -* ``isCredentialsNonExpired()`` checks whether the user's credentials (password) - has expired, -* ``isEnabled()`` checks whether the user is enabled. +* :method:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface::isAccountNonExpired` + checks whether the user's account has expired, +* :method:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface::isAccountNonLocked` + checks whether the user is locked, +* :method:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface::isCredentialsNonExpired` + checks whether the user's credentials (password) has expired, +* :method:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface::isEnabled` + checks whether the user is enabled. For this example, the first three methods will return ``true`` whereas the ``isEnabled()`` method will return the boolean value in the ``isActive`` field. From 3b557a04bef32cd36d21c9db1f07633ddaa6e919 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 4 Jun 2014 22:13:41 +0200 Subject: [PATCH 11/16] Fixed the formatting of several lists to avoid problems when rendering the documentation on the website --- components/http_kernel/introduction.rst | 74 ++++++++++----------- cookbook/form/data_transformers.rst | 22 +++--- cookbook/form/dynamic_form_modification.rst | 22 +++--- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index 23eab799e7b..33cac4f2b56 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -241,23 +241,23 @@ will be called after another event - ``kernel.controller`` - is dispatched. information is typically placed on the ``Request`` via the ``RouterListener``). This string is then transformed into a PHP callable by doing the following: - a) The ``AcmeDemoBundle:Default:index`` format of the ``_controller`` key - is changed to another string that contains the full class and method - name of the controller by following the convention used in Symfony2 - e.g. - ``Acme\DemoBundle\Controller\DefaultController::indexAction``. This transformation - is specific to the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver` - sub-class used by the Symfony2 Framework. + #. The ``AcmeDemoBundle:Default:index`` format of the ``_controller`` key + is changed to another string that contains the full class and method + name of the controller by following the convention used in Symfony2 - e.g. + ``Acme\DemoBundle\Controller\DefaultController::indexAction``. This transformation + is specific to the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver` + sub-class used by the Symfony2 Framework. - b) A new instance of your controller class is instantiated with no - constructor arguments. + #. A new instance of your controller class is instantiated with no + constructor arguments. - c) If the controller implements :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface`, - ``setContainer`` is called on the controller object and the container - is passed to it. This step is also specific to the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver` - sub-class used by the Symfony2 Framework. + #. If the controller implements :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface`, + ``setContainer`` is called on the controller object and the container + is passed to it. This step is also specific to the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver` + sub-class used by the Symfony2 Framework. - There are also a few other variations on the above process (e.g. if - you're registering your controllers as services). + There are also a few other variations on the above process (e.g. if + you're registering your controllers as services). .. _component-http-kernel-kernel-controller: @@ -324,15 +324,15 @@ of arguments that should be passed when executing that callable. It then iterates over each of these arguments and uses the following tricks to determine which value should be passed for each argument: - a) If the ``Request`` attributes bag contains a key that matches the name - of the argument, that value is used. For example, if the first argument - to a controller is ``$slug``, and there is a ``slug`` key in the ``Request`` - ``attributes`` bag, that value is used (and typically this value came - from the ``RouterListener``). + #. If the ``Request`` attributes bag contains a key that matches the name + of the argument, that value is used. For example, if the first argument + to a controller is ``$slug``, and there is a ``slug`` key in the ``Request`` + ``attributes`` bag, that value is used (and typically this value came + from the ``RouterListener``). - b) If the argument in the controller is type-hinted with Symfony's - :class:`Symfony\\Component\\HttpFoundation\\Request` object, then the - ``Request`` is passed in as the value. + #. If the argument in the controller is type-hinted with Symfony's + :class:`Symfony\\Component\\HttpFoundation\\Request` object, then the + ``Request`` is passed in as the value. .. _component-http-kernel-calling-controller: @@ -527,21 +527,21 @@ below for more details). and is called :class:`Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener`. The listener has several goals: - 1) The thrown exception is converted into a - :class:`Symfony\\Component\\HttpKernel\\Exception\\FlattenException` - object, which contains all the information about the request, but which - can be printed and serialized. - - 2) If the original exception implements - :class:`Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface`, - then ``getStatusCode`` and ``getHeaders`` are called on the exception - and used to populate the headers and status code of the ``FlattenException`` - object. The idea is that these are used in the next step when creating - the final response. - - 3) A controller is executed and passed the flattened exception. The exact - controller to render is passed as a constructor argument to this listener. - This controller will return the final ``Response`` for this error page. + #. The thrown exception is converted into a + :class:`Symfony\\Component\\HttpKernel\\Exception\\FlattenException` + object, which contains all the information about the request, but which + can be printed and serialized. + + #. If the original exception implements + :class:`Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface`, + then ``getStatusCode`` and ``getHeaders`` are called on the exception + and used to populate the headers and status code of the ``FlattenException`` + object. The idea is that these are used in the next step when creating + the final response. + + #. A controller is executed and passed the flattened exception. The exact + controller to render is passed as a constructor argument to this listener. + This controller will return the final ``Response`` for this error page. **ExceptionListener in Security** diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index 3192092ca5c..8c03f010da4 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -189,21 +189,21 @@ types of underlying data. .. image:: /images/cookbook/form/DataTransformersTypes.png :align: center -In any form, the 3 different types of data are: +In any form, the three different types of data are: -1) **Model data** - This is the data in the format used in your application -(e.g. an ``Issue`` object). If you call ``Form::getData`` or ``Form::setData``, -you're dealing with the "model" data. +#. **Model data** - This is the data in the format used in your application + (e.g. an ``Issue`` object). If you call ``Form::getData`` or ``Form::setData``, + you're dealing with the "model" data. -2) **Norm Data** - This is a normalized version of your data, and is commonly -the same as your "model" data (though not in our example). It's not commonly -used directly. +#. **Norm Data** - This is a normalized version of your data, and is commonly + the same as your "model" data (though not in our example). It's not commonly + used directly. -3) **View Data** - This is the format that's used to fill in the form fields -themselves. It's also the format in which the user will submit the data. When -you call ``Form::submit($data)``, the ``$data`` is in the "view" data format. +#. **View Data** - This is the format that's used to fill in the form fields + themselves. It's also the format in which the user will submit the data. When + you call ``Form::submit($data)``, the ``$data`` is in the "view" data format. -The 2 different types of transformers help convert to and from each of these +The two different types of transformers help convert to and from each of these types of data: **Model transformers**: diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 5f56ed77f4e..5efdbc70521 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -7,22 +7,22 @@ How to Dynamically Modify Forms Using Form Events Often times, a form can't be created statically. In this entry, you'll learn how to customize your form based on three common use-cases: -1) :ref:`cookbook-form-events-underlying-data` +#. :ref:`cookbook-form-events-underlying-data` -Example: you have a "Product" form and need to modify/add/remove a field -based on the data on the underlying Product being edited. + Example: you have a "Product" form and need to modify/add/remove a field + based on the data on the underlying Product being edited. -2) :ref:`cookbook-form-events-user-data` +#. :ref:`cookbook-form-events-user-data` -Example: you create a "Friend Message" form and need to build a drop-down -that contains only users that are friends with the *current* authenticated -user. + Example: you create a "Friend Message" form and need to build a drop-down + that contains only users that are friends with the *current* authenticated + user. -3) :ref:`cookbook-form-events-submitted-data` +#. :ref:`cookbook-form-events-submitted-data` -Example: on a registration form, you have a "country" field and a "state" -field which should populate dynamically based on the value in the "country" -field. + Example: on a registration form, you have a "country" field and a "state" + field which should populate dynamically based on the value in the "country" + field. If you wish to learn more about the basics behind form events, you can take a look at the :doc:`Form Events ` From e871a324374a7f0599257590e5e35400e04b5b9e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 4 Jun 2014 22:17:08 +0200 Subject: [PATCH 12/16] Fixed a very minor indentation issue --- book/doctrine.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index 3e823bfe8a4..b89bb983476 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -416,7 +416,7 @@ doesn't replace your existing methods). * generate getters and setters; * generate repository classes configured with the - ``@ORM\Entity(repositoryClass="...")`` annotation; + ``@ORM\Entity(repositoryClass="...")`` annotation; * generate the appropriate constructor for 1:n and n:m relations. From b22341759e4756f724d5aa93cc1c5e74150a2ae9 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 4 Jun 2014 23:03:15 +0200 Subject: [PATCH 13/16] Replaced a sidebar with a tip directive --- components/routing/hostname_pattern.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index 505fce547b1..8b47cdd6474 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -176,7 +176,7 @@ instance, if you want to match both ``m.example.com`` and return $collection; -.. sidebar:: Using Service Parameters +.. tip:: You can also use service parameters if you do not want to hardcode the hostname. Make sure you also include a default option for the ``domain`` From 03b83baace6c931b2986c54d1bcd1ecabf5aac12 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 4 Jun 2014 23:11:38 +0200 Subject: [PATCH 14/16] Splitted one tip directive into two smaller tips --- components/routing/hostname_pattern.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index 8b47cdd6474..145605aeac3 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -179,9 +179,7 @@ instance, if you want to match both ``m.example.com`` and .. tip:: You can also use service parameters if you do not want to hardcode the - hostname. Make sure you also include a default option for the ``domain`` - placeholder, otherwise you need to include a domain value each time you - generate a URL using the route. + hostname: .. configuration-block:: @@ -238,6 +236,12 @@ instance, if you want to match both ``m.example.com`` and return $collection; +.. tip:: + + Make sure you also include a default option for the ``domain`` placeholder, + otherwise you need to include a domain value each time you generate + a URL using the route. + .. _component-routing-host-imported: Using Host Matching of Imported Routes From d38f00e71f83563a43bdd5bf50bfd8536b11baab Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 4 Jun 2014 23:14:31 +0200 Subject: [PATCH 15/16] Fixed a minor indenttation issue --- components/routing/hostname_pattern.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index 145605aeac3..df69510e8af 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -289,7 +289,7 @@ Testing your Controllers You need to set the Host HTTP header on your request objects if you want to get past url matching in your functional tests. - .. code-block:: php +.. code-block:: php $crawler = $client->request( 'GET', From 24428393a49dd5ac9bbb8ea9906d07e41198ef7e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 6 Jun 2014 13:36:27 +0200 Subject: [PATCH 16/16] Reverted the changes in the numbered lists The original problem was solved with a proper indentation of the contents, so it's not necessary to change the way the item numbers are defined. --- components/http_kernel/introduction.rst | 16 ++++++++-------- cookbook/form/data_transformers.rst | 6 +++--- cookbook/form/dynamic_form_modification.rst | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index 33cac4f2b56..a28033239a6 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -241,17 +241,17 @@ will be called after another event - ``kernel.controller`` - is dispatched. information is typically placed on the ``Request`` via the ``RouterListener``). This string is then transformed into a PHP callable by doing the following: - #. The ``AcmeDemoBundle:Default:index`` format of the ``_controller`` key + a) The ``AcmeDemoBundle:Default:index`` format of the ``_controller`` key is changed to another string that contains the full class and method name of the controller by following the convention used in Symfony2 - e.g. ``Acme\DemoBundle\Controller\DefaultController::indexAction``. This transformation is specific to the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver` sub-class used by the Symfony2 Framework. - #. A new instance of your controller class is instantiated with no + b) A new instance of your controller class is instantiated with no constructor arguments. - #. If the controller implements :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface`, + c) If the controller implements :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface`, ``setContainer`` is called on the controller object and the container is passed to it. This step is also specific to the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver` sub-class used by the Symfony2 Framework. @@ -324,13 +324,13 @@ of arguments that should be passed when executing that callable. It then iterates over each of these arguments and uses the following tricks to determine which value should be passed for each argument: - #. If the ``Request`` attributes bag contains a key that matches the name + a) If the ``Request`` attributes bag contains a key that matches the name of the argument, that value is used. For example, if the first argument to a controller is ``$slug``, and there is a ``slug`` key in the ``Request`` ``attributes`` bag, that value is used (and typically this value came from the ``RouterListener``). - #. If the argument in the controller is type-hinted with Symfony's + b) If the argument in the controller is type-hinted with Symfony's :class:`Symfony\\Component\\HttpFoundation\\Request` object, then the ``Request`` is passed in as the value. @@ -527,19 +527,19 @@ below for more details). and is called :class:`Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener`. The listener has several goals: - #. The thrown exception is converted into a + 1) The thrown exception is converted into a :class:`Symfony\\Component\\HttpKernel\\Exception\\FlattenException` object, which contains all the information about the request, but which can be printed and serialized. - #. If the original exception implements + 2) If the original exception implements :class:`Symfony\\Component\\HttpKernel\\Exception\\HttpExceptionInterface`, then ``getStatusCode`` and ``getHeaders`` are called on the exception and used to populate the headers and status code of the ``FlattenException`` object. The idea is that these are used in the next step when creating the final response. - #. A controller is executed and passed the flattened exception. The exact + 3) A controller is executed and passed the flattened exception. The exact controller to render is passed as a constructor argument to this listener. This controller will return the final ``Response`` for this error page. diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index 8c03f010da4..f847127c894 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -191,15 +191,15 @@ types of underlying data. In any form, the three different types of data are: -#. **Model data** - This is the data in the format used in your application +1) **Model data** - This is the data in the format used in your application (e.g. an ``Issue`` object). If you call ``Form::getData`` or ``Form::setData``, you're dealing with the "model" data. -#. **Norm Data** - This is a normalized version of your data, and is commonly +2) **Norm Data** - This is a normalized version of your data, and is commonly the same as your "model" data (though not in our example). It's not commonly used directly. -#. **View Data** - This is the format that's used to fill in the form fields +3) **View Data** - This is the format that's used to fill in the form fields themselves. It's also the format in which the user will submit the data. When you call ``Form::submit($data)``, the ``$data`` is in the "view" data format. diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 5efdbc70521..262b34347d5 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -7,18 +7,18 @@ How to Dynamically Modify Forms Using Form Events Often times, a form can't be created statically. In this entry, you'll learn how to customize your form based on three common use-cases: -#. :ref:`cookbook-form-events-underlying-data` +1) :ref:`cookbook-form-events-underlying-data` Example: you have a "Product" form and need to modify/add/remove a field based on the data on the underlying Product being edited. -#. :ref:`cookbook-form-events-user-data` +2) :ref:`cookbook-form-events-user-data` Example: you create a "Friend Message" form and need to build a drop-down that contains only users that are friends with the *current* authenticated user. -#. :ref:`cookbook-form-events-submitted-data` +3) :ref:`cookbook-form-events-submitted-data` Example: on a registration form, you have a "country" field and a "state" field which should populate dynamically based on the value in the "country"