Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

Commit

Permalink
Fix doc markup
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed May 28, 2021
1 parent 1d5c876 commit 5ffb63d
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 91 deletions.
8 changes: 4 additions & 4 deletions src/Resources/doc/annotations/cache.rst
Expand Up @@ -7,7 +7,7 @@ and validation.
HTTP Expiration Strategies
--------------------------

The ``@Cache`` annotation allows to define HTTP caching::
The ``@Cache`` annotation allows to define HTTP caching:

.. configuration-block::

Expand All @@ -32,7 +32,7 @@ The ``@Cache`` annotation allows to define HTTP caching::
}
You can also use the annotation on a class to define caching for all actions
of a controller::
of a controller:

.. configuration-block::

Expand All @@ -53,7 +53,7 @@ of a controller::
}
When there is a conflict between the class configuration and the method
configuration, the latter overrides the former::
configuration, the latter overrides the former:

.. configuration-block::

Expand Down Expand Up @@ -98,7 +98,7 @@ headers. ``lastModified`` adds a ``Last-Modified`` header to Responses and
``Etag`` adds an ``Etag`` header.

Both automatically trigger the logic to return a 304 response when the
response is not modified (in this case, the controller is **not** called)::
response is not modified (in this case, the controller is **not** called):

.. configuration-block::

Expand Down
144 changes: 72 additions & 72 deletions src/Resources/doc/annotations/converters.rst
Expand Up @@ -6,7 +6,7 @@ Usage

The ``@ParamConverter`` annotation calls *converters* to convert request
parameters to objects. These objects are stored as request attributes and so
they can be injected as controller method arguments::
they can be injected as controller method arguments:

.. configuration-block::

Expand Down Expand Up @@ -107,7 +107,7 @@ entities fetched from the database. Several different approaches are possible:
......................

If your route wildcards match properties on your entity, then the converter
will automatically fetch them::
will automatically fetch them:

.. configuration-block::

Expand Down Expand Up @@ -164,7 +164,7 @@ annotation and using the `@ParamConverter options`_.
2) Fetch via an Expression
..........................

If automatic fetching doesn't work, use an expression::
If automatic fetching doesn't work, use an expression:

.. configuration-block::

Expand Down Expand Up @@ -200,7 +200,7 @@ any route wildcards - like ``{post_id}`` are available as variables.
The ``@Entity`` annotation is a shortcut for using ``expr``
and has all the same options as ``@ParamConverter``.

This can also be used to help resolve multiple arguments::
This can also be used to help resolve multiple arguments:

.. configuration-block::

Expand Down Expand Up @@ -236,100 +236,100 @@ A number of ``options`` are available on the ``@ParamConverter`` or
* ``id``: If an ``id`` option is configured and matches a route parameter, then the
converter will find by the primary key::

.. configuration-block::
.. configuration-block::

.. code-block:: php-annotations
.. code-block:: php-annotations
/**
* @Route("/blog/{post_id}")
* @ParamConverter("post", options={"id" = "post_id"})
*/
public function showPost(Post $post)
{
}
.. code-block:: php-attributes
/**
* @Route("/blog/{post_id}")
* @ParamConverter("post", options={"id" = "post_id"})
*/
public function showPost(Post $post)
{
}
#[Route('/blog/{post_id}')]
#[Entity('post', options: ['id' => 'post_id'])]
public function showPost(Post $post)
{
}
.. code-block:: php-attributes
#[Route('/blog/{post_id}')]
#[Entity('post', options: ['id' => 'post_id'])]
public function showPost(Post $post)
{
}
* ``mapping``: Configures the properties and values to use with the ``findOneBy()``
method: the key is the route placeholder name and the value is the Doctrine property
name::
name:

.. configuration-block::
.. configuration-block::

.. code-block:: php-annotations
.. code-block:: php-annotations
/**
* @Route("/blog/{date}/{slug}/comments/{comment_slug}")
* @ParamConverter("post", options={"mapping": {"date": "date", "slug": "slug"}})
* @ParamConverter("comment", options={"mapping": {"comment_slug": "slug"}})
*/
public function showComment(Post $post, Comment $comment)
{
}
/**
* @Route("/blog/{date}/{slug}/comments/{comment_slug}")
* @ParamConverter("post", options={"mapping": {"date": "date", "slug": "slug"}})
* @ParamConverter("comment", options={"mapping": {"comment_slug": "slug"}})
*/
public function showComment(Post $post, Comment $comment)
{
}
.. code-block:: php-attributes
.. code-block:: php-attributes
#[Route('/blog/{date}/{slug}/comments/{comment_slug}')]
#[ParamConverter('post', options: ['mapping' => ['date' => 'date', 'slug' => 'slug']])]
#[ParamConverter('comment', options: ['mapping': ['comment_slug' => 'slug']])]
public function showComment(Post $post, Comment $comment)
{
}
#[Route('/blog/{date}/{slug}/comments/{comment_slug}')]
#[ParamConverter('post', options: ['mapping' => ['date' => 'date', 'slug' => 'slug']])]
#[ParamConverter('comment', options: ['mapping': ['comment_slug' => 'slug']])]
public function showComment(Post $post, Comment $comment)
{
}
* ``exclude`` Configures the properties that should be used in the ``findOneBy()``
method by *excluding* one or more properties so that not *all* are used::
method by *excluding* one or more properties so that not *all* are used:

.. configuration-block::
.. configuration-block::

.. code-block:: php-annotations
.. code-block:: php-annotations
/**
* @Route("/blog/{date}/{slug}")
* @ParamConverter("post", options={"exclude": {"date"}})
*/
public function show(Post $post, \DateTime $date)
{
}
/**
* @Route("/blog/{date}/{slug}")
* @ParamConverter("post", options={"exclude": {"date"}})
*/
public function show(Post $post, \DateTime $date)
{
}
.. code-block:: php-attributes
.. code-block:: php-attributes
#[Route('/blog/{date}/{slug}')]
#[ParamConverter('post', options: ['exclude' => ['date']])]
public function show(Post $post, \DateTime $date)
{
}
#[Route('/blog/{date}/{slug}')]
#[ParamConverter('post', options: ['exclude' => ['date']])]
public function show(Post $post, \DateTime $date)
{
}
* ``strip_null`` If true, then when ``findOneBy()`` is used, any values that are
``null`` will not be used for the query.

* ``entity_manager`` By default, the Doctrine converter uses the *default* entity
manager, but you can configure this::
manager, but you can configure this:

.. configuration-block::
.. configuration-block::

.. code-block:: php-annotations
.. code-block:: php-annotations
/**
* @Route("/blog/{id}")
* @ParamConverter("post", options={"entity_manager" = "foo"})
*/
public function show(Post $post)
{
}
/**
* @Route("/blog/{id}")
* @ParamConverter("post", options={"entity_manager" = "foo"})
*/
public function show(Post $post)
{
}
.. code-block:: php-attributes
.. code-block:: php-attributes
#[Route('/blog/{id}')]
#[ParamConverter('post', options: ['entity_manager' => 'foo'])]
public function show(Post $post)
{
}
#[Route('/blog/{id}')]
#[ParamConverter('post', options: ['entity_manager' => 'foo'])]
public function show(Post $post)
{
}
* ``evict_cache`` If true, forces Doctrine to always fetch the entity from the database instead of cache.

Expand All @@ -339,7 +339,7 @@ DateTime Converter
Converter Name: ``datetime``

The datetime converter converts any route or request attribute into a datetime
instance::
instance:

.. configuration-block::

Expand All @@ -360,7 +360,7 @@ instance::
}
By default any date format that can be parsed by the ``DateTime`` constructor
is accepted. You can be stricter with input given through the options::
is accepted. You can be stricter with input given through the options:

.. configuration-block::

Expand Down
12 changes: 6 additions & 6 deletions src/Resources/doc/annotations/security.rst
Expand Up @@ -4,7 +4,7 @@
Usage
-----

The ``@Security`` and ``@IsGranted`` annotations restrict access on controllers::
The ``@Security`` and ``@IsGranted`` annotations restrict access on controllers:

.. configuration-block::

Expand Down Expand Up @@ -50,7 +50,7 @@ The ``@Security`` and ``@IsGranted`` annotations restrict access on controllers:

The ``@IsGranted()`` annotation is the simplest way to restrict access.
Use it to restrict by roles, or use custom voters to restrict access based
on variables passed to the controller::
on variables passed to the controller:

.. configuration-block::

Expand Down Expand Up @@ -82,7 +82,7 @@ Each ``IsGranted()`` must grant access for the user to have access to the contro
The ``@IsGranted("POST_SHOW", subject="post")`` is an example of using
a custom security voter. For more details, see `the Security Voters page`_.

You can also control the message and status code::
You can also control the message and status code:

.. configuration-block::

Expand Down Expand Up @@ -115,7 +115,7 @@ You can also control the message and status code::
---------

The ``@Security`` annotation is more flexible than ``@IsGranted``: it
allows you to pass an *expression* that can contain custom logic::
allows you to pass an *expression* that can contain custom logic:

.. configuration-block::

Expand Down Expand Up @@ -152,7 +152,7 @@ The expression has access to the following variables:
You can throw an ``Symfony\Component\HttpKernel\Exception\HttpException``
exception instead of
``Symfony\Component\Security\Core\Exception\AccessDeniedException`` using the
``statusCode`` option::
``statusCode`` option:

.. configuration-block::

Expand All @@ -172,7 +172,7 @@ exception instead of
{
}
The ``message`` option allows you to customize the exception message::
The ``message`` option allows you to customize the exception message:

.. configuration-block::

Expand Down
13 changes: 6 additions & 7 deletions src/Resources/doc/annotations/view.rst
Expand Up @@ -4,7 +4,7 @@
Usage
-----

The ``@Template`` annotation associates a controller with a template name::
The ``@Template`` annotation associates a controller with a template name:

.. configuration-block::

Expand Down Expand Up @@ -41,7 +41,7 @@ array of parameters to pass to the view instead of a ``Response`` object.

.. note::

If you want to stream your template, you can make it with the following configuration::
If you want to stream your template, you can make it with the following configuration:

.. configuration-block::

Expand Down Expand Up @@ -69,7 +69,7 @@ array of parameters to pass to the view instead of a ``Response`` object.
simply ignored.

If the template is named after the controller and action names, which is the
case for the above example, you can even omit the annotation value::
case for the above example, you can even omit the annotation value:

.. configuration-block::

Expand Down Expand Up @@ -106,7 +106,7 @@ case for the above example, you can even omit the annotation value::
And if the only parameters to pass to the template are method arguments, you
can use the ``vars`` attribute instead of returning an array. This is very
useful in combination with the ``@ParamConverter`` :doc:`annotation
<converters>`::
<converters>`:

.. configuration-block::

Expand All @@ -128,7 +128,7 @@ useful in combination with the ``@ParamConverter`` :doc:`annotation
{
}
which, thanks to conventions, is equivalent to the following configuration::
which, thanks to conventions, is equivalent to the following configuration:

.. configuration-block::

Expand All @@ -150,7 +150,7 @@ which, thanks to conventions, is equivalent to the following configuration::
You can make it even more concise as all method arguments are automatically
passed to the template if the method returns ``null`` and no ``vars`` attribute
is defined::
is defined:

.. configuration-block::

Expand All @@ -169,4 +169,3 @@ is defined::
public function show(Post $post)
{
}
4 changes: 2 additions & 2 deletions src/Resources/doc/index.rst
Expand Up @@ -94,7 +94,7 @@ The following annotations are defined by the bundle:
annotations/security

This example shows all the available annotations in action (here and in all
the other examples both plain old annotations and PHP 8.0 are shown)::
the other examples both plain old annotations and PHP 8.0 are shown):

.. configuration-block::

Expand Down Expand Up @@ -174,7 +174,7 @@ the other examples both plain old annotations and PHP 8.0 are shown)::
}
As the ``showAction`` method follows some conventions, you can omit some
annotations::
annotations:

.. configuration-block::

Expand Down

0 comments on commit 5ffb63d

Please sign in to comment.