Skip to content
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

Normalize the method listings on version 2.5 #4551

Closed
wants to merge 2 commits into from
Closed
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
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