Skip to content

Commit

Permalink
Normalize the method listings on version 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronofuentes authored and wouterj committed Dec 17, 2014
1 parent 33554fc commit 2665407
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 25 deletions.
10 changes: 6 additions & 4 deletions book/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down
44 changes: 25 additions & 19 deletions book/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <book-security-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 <book-security-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``

Expand Down
6 changes: 4 additions & 2 deletions book/service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2665407

Please sign in to comment.