diff --git a/book/routing.rst b/book/routing.rst index 582526f2d01..0f3c2900bdf 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -967,10 +967,12 @@ header matches ``firefox``. You can do any complex logic you need in the expression by leveraging two variables that are passed into the expression: -* ``context``: An instance of :class:`Symfony\\Component\\Routing\\RequestContext`, - which holds the most fundamental information about the route being matched; -* ``request``: The Symfony :class:`Symfony\\Component\\HttpFoundation\\Request` - object (see :ref:`component-http-foundation-request`). +``context`` + An instance of :class:`Symfony\\Component\\Routing\\RequestContext`, which + holds the most fundamental information about the route being matched. +``request`` + The Symfony :class:`Symfony\\Component\\HttpFoundation\\Request` object + (see :ref:`component-http-foundation-request`). .. caution:: diff --git a/book/security.rst b/book/security.rst index d63d6c9a3dc..4530f439f40 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1922,28 +1922,34 @@ syntax, see :doc:`/components/expression_language/syntax`. Inside the expression, you have access to a number of variables: -* ``user`` The user object (or the string ``anon`` if you're not authenticated); -* ``roles`` The array of roles the user has, including from the - :ref:`role hierarchy ` but not including - the ``IS_AUTHENTICATED_*`` attributes (see the functions below); -* ``object``: The object (if any) that's passed as the second argument to - ``isGranted`` ; -* ``token`` The token object; -* ``trust_resolver``: The :class:`Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolverInterface`, - object: you'll probably use the ``is_*`` functions below instead. +``user`` + The user object (or the string ``anon`` if you're not authenticated). +``roles`` + The array of roles the user has, including from the + :ref:`role hierarchy ` but not including the + ``IS_AUTHENTICATED_*`` attributes (see the functions below). +``object`` + The object (if any) that's passed as the second argument to ``isGranted``. +``token`` + The token object. +``trust_resolver`` + The :class:`Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolverInterface`, + object: you'll probably use the ``is_*`` functions below instead. Additionally, you have access to a number of functions inside the expression: -* ``is_authenticated``: Returns ``true`` if the user is authenticated via "remember-me" - or authenticated "fully" - i.e. returns true if the user is "logged in"; -* ``is_anonymous``: Equal to using ``IS_AUTHENTICATED_ANONYMOUSLY`` with - the ``isGranted`` function; -* ``is_remember_me``: Similar, but not equal to ``IS_AUTHENTICATED_REMEMBERED``, - see below; -* ``is_fully_authenticated``: Similar, but not equal to ``IS_AUTHENTICATED_FULLY``, - see below; -* ``has_role``: Checks to see if the user has the given role - equivalent - to an expression like ``'ROLE_ADMIN' in roles``. +``is_authenticated`` + Returns ``true`` if the user is authenticated via "remember-me" or authenticated + "fully" - i.e. returns true if the user is "logged in". +``is_anonymous`` + Equal to using ``IS_AUTHENTICATED_ANONYMOUSLY`` with the ``isGranted`` function. +``is_remember_me`` + Similar, but not equal to ``IS_AUTHENTICATED_REMEMBERED``, see below. +``is_fully_authenticated`` + Similar, but not equal to ``IS_AUTHENTICATED_FULLY``, see below. +``has_role`` + Checks to see if the user has the given role - equivalent to an expression like + ``'ROLE_ADMIN' in roles``. .. sidebar:: ``is_remember_me`` is different than checking ``IS_AUTHENTICATED_REMEMBERED`` diff --git a/book/service_container.rst b/book/service_container.rst index 1c939969b6f..3636e986d67 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -694,8 +694,10 @@ To learn more about the expression language syntax, see :doc:`/components/expres In this context, you have access to 2 functions: -* ``service`` - returns a given service (see the example above); -* ``parameter`` - returns a specific parameter value (syntax is just like ``service``) +``service`` + Returns a given service (see the example above). +``parameter`` + Returns a specific parameter value (syntax is just like ``service``). You also have access to the :class:`Symfony\\Component\\DependencyInjection\\ContainerBuilder` via a ``container`` variable. Here's another example: