diff --git a/best_practices/forms.rst b/best_practices/forms.rst index d68418d71b5..921a51ddeb8 100644 --- a/best_practices/forms.rst +++ b/best_practices/forms.rst @@ -47,11 +47,17 @@ form in its own PHP class:: } } +.. best-practice:: + + Put the form type classes in the ``AppBundle\Form`` namespace, unless you + use other custom form classes like data transformers. + To use the class, use ``createForm`` and pass the fully qualified class name:: - use AppBundle\Form\PostType; // ... + use AppBundle\Form\PostType; + // ... public function newAction(Request $request) { $post = new Post(); diff --git a/book/controller.rst b/book/controller.rst index ca8010416f9..cb92c501438 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -441,10 +441,6 @@ If you want to redirect the user to another page, use the ``redirectToRoute()`` // return $this->redirect($this->generateUrl('homepage'), 301); } -.. versionadded:: 2.6 - The ``redirectToRoute()`` method was introduced in Symfony 2.6. Previously (and still now), you - could use ``redirect()`` and ``generateUrl()`` together for this (see the example above). - Or, if you want to redirect externally, just use ``redirect()`` and pass it the URL:: public function indexAction() @@ -536,9 +532,6 @@ console command: $ php bin/console debug:container -.. versionadded:: 2.6 - Prior to Symfony 2.6, this command was called ``container:debug``. - For more information, see the :doc:`/book/service_container` chapter. .. index:: @@ -825,16 +818,10 @@ method to check the CSRF token:: // ... do something, like deleting an object } -.. versionadded:: 2.6 - The ``isCsrfTokenValid()`` shortcut method was introduced in Symfony 2.6. - It is equivalent to executing the following code: - - .. code-block:: php - - use Symfony\Component\Security\Csrf\CsrfToken; - - $this->get('security.csrf.token_manager') - ->isTokenValid(new CsrfToken('token_id', 'TOKEN')); + // isCsrfTokenValid() is equivalent to: + // $this->get('security.csrf.token_manager')->isTokenValid() + // new \Symfony\Component\Security\Csrf\CsrfToken\CsrfToken('token_id', $token) + // ); Final Thoughts -------------- diff --git a/book/routing.rst b/book/routing.rst index aaeeea2a627..514e2a44cd4 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1403,9 +1403,6 @@ the command by running the following from the root of your project. $ php bin/console debug:router -.. versionadded:: 2.6 - Prior to Symfony 2.6, this command was called ``router:debug``. - This command will print a helpful list of *all* the configured routes in your application: diff --git a/book/security.rst b/book/security.rst index 668830e468b..5a5a6bf4bcf 100644 --- a/book/security.rst +++ b/book/security.rst @@ -844,15 +844,6 @@ You can easily deny access from inside a controller:: // ... } -.. versionadded:: 2.6 - The ``denyAccessUnlessGranted()`` method was introduced in Symfony 2.6. Previously (and - still now), you could check access directly and throw the ``AccessDeniedException`` as shown - in the example above). - -.. versionadded:: 2.6 - The ``security.authorization_checker`` service was introduced in Symfony 2.6. Prior - to Symfony 2.6, you had to use the ``isGranted()`` method of the ``security.context`` service. - In both cases, a special :class:`Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException` is thrown, which ultimately triggers a 403 HTTP response inside Symfony. @@ -1017,10 +1008,6 @@ shown above. Retrieving the User Object -------------------------- -.. versionadded:: 2.6 - The ``security.token_storage`` service was introduced in Symfony 2.6. Prior - to Symfony 2.6, you had to use the ``getToken()`` method of the ``security.context`` service. - After authentication, the ``User`` object of the current user can be accessed via the ``security.token_storage`` service. From inside a controller, this will look like:: @@ -1221,9 +1208,6 @@ in the following way from a controller:: $user->setPassword($encoded); -.. versionadded:: 2.6 - The ``security.password_encoder`` service was introduced in Symfony 2.6. - In order for this to work, just make sure that you have the encoder for your user class (e.g. ``AppBundle\Entity\User``) configured under the ``encoders`` key in ``app/config/security.yml``. diff --git a/book/service_container.rst b/book/service_container.rst index f8c670c0978..82bceae958f 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -1136,9 +1136,6 @@ console. To show all services and the class for each service, run: $ php bin/console debug:container -.. versionadded:: 2.6 - Prior to Symfony 2.6, this command was called ``container:debug``. - By default, only public services are shown, but you can also view private services: .. code-block:: bash diff --git a/book/templating.rst b/book/templating.rst index 2d5b37f90c4..52963f0b1fb 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -1269,12 +1269,6 @@ automatically:

Application Environment: getEnvironment() ?>

-.. versionadded:: 2.6 - The global ``app.security`` variable (or the ``$app->getSecurity()`` - method in PHP templates) is deprecated as of Symfony 2.6. Use ``app.user`` - (``$app->getUser()``) and ``is_granted()`` (``$view['security']->isGranted()``) - instead. - .. tip:: You can add your own global template variables. See the cookbook example diff --git a/book/testing.rst b/book/testing.rst index 4d0a9d3613b..d56eacb7e10 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -470,9 +470,6 @@ Be warned that this does not work if you insulate the client or if you use an HTTP layer. For a list of services available in your application, use the ``debug:container`` console task. -.. versionadded:: 2.6 - Prior to Symfony 2.6, this command was called ``container:debug``. - .. tip:: If the information you need to check is available from the profiler, use diff --git a/book/translation.rst b/book/translation.rst index b9d20077e7d..e751320bdae 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -452,9 +452,6 @@ checks translation resources for several locales: #. If the translation still isn't found, Symfony uses the ``fallbacks`` configuration parameter, which defaults to ``en`` (see `Configuration`_). -.. versionadded:: 2.6 - The ability to log missing translations was introduced in Symfony 2.6. - .. note:: When Symfony doesn't find a translation in the given locale, it will @@ -746,9 +743,6 @@ For more information, see the documentation for these libraries. Debugging Translations ---------------------- -.. versionadded:: 2.6 - Prior to Symfony 2.6, this command was called ``translation:debug``. - When maintaining a bundle, you may use or remove the usage of a translation message without updating all message catalogues. The ``debug:translation`` command helps you to find these missing or unused translation messages for a diff --git a/book/validation.rst b/book/validation.rst index 74e0c97bfaf..c5c4b48d8e6 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -644,7 +644,7 @@ this method must return ``true``: AppBundle\Entity\Author: getters: passwordLegal: - - 'True': { message: 'The password cannot match your first name' } + - 'IsTrue': { message: 'The password cannot match your first name' } .. code-block:: xml @@ -656,7 +656,7 @@ this method must return ``true``: - + @@ -954,7 +954,7 @@ username and the password are different only if all other validation passes - Strict getters: passwordLegal: - - 'True': + - 'IsTrue': message: 'The password cannot match your username' groups: [Strict] properties: @@ -981,7 +981,7 @@ username and the password are different only if all other validation passes - +