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

[Docs] Remove action-suffix for contoller actions #609

Merged
merged 1 commit into from Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions Resources/doc/annotations/cache.rst
Expand Up @@ -14,7 +14,7 @@ The ``@Cache`` annotation makes it easy to define HTTP caching::
/**
* @Cache(expires="tomorrow", public=true)
*/
public function indexAction()
public function index()
{
}

Expand All @@ -39,7 +39,7 @@ configuration, the latter overrides the former::
/**
* @Cache(expires="+2 days")
*/
public function indexAction()
public function index()
{
}
}
Expand All @@ -64,15 +64,15 @@ response is not modified (in this case, the controller is **not** called)::
/**
* @Cache(lastModified="post.getUpdatedAt()", Etag="'Post' ~ post.getId() ~ post.getUpdatedAt().getTimestamp()")
*/
public function indexAction(Post $post)
public function index(Post $post)
{
// your code
// won't be called in case of a 304
}

It's roughly doing the same as the following code::

public function myAction(Request $request, Post $post)
public function my(Request $request, Post $post)
{
$response = new Response();
$response->setLastModified($post->getUpdatedAt());
Expand Down Expand Up @@ -109,4 +109,4 @@ Annotation Response

.. note::

smaxage, maxage and maxstale attributes can also get a string with relative time format (1 day, 2 weeks, ...).
smaxage, maxage and maxstale attributes can also get a string with relative time format (1 day, 2 weeks, ...).
24 changes: 12 additions & 12 deletions Resources/doc/annotations/converters.rst
Expand Up @@ -15,7 +15,7 @@ they can be injected as controller method arguments::
* @Route("/blog/{id}")
* @ParamConverter("post", class="SensioBlogBundle:Post")
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand All @@ -37,7 +37,7 @@ If you use type hinting as in the example above, you can even omit the
``@ParamConverter`` annotation altogether::

// automatic with method signature
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand Down Expand Up @@ -114,7 +114,7 @@ the converter will automatically fetch them::
*
* @Route("/blog/{id}")
*/
public function showByPkAction(Post $post)
public function showByPk(Post $post)
{
}

Expand All @@ -123,7 +123,7 @@ the converter will automatically fetch them::
*
* @Route("/blog/{slug}")
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand Down Expand Up @@ -151,7 +151,7 @@ an expression::
* @Route("/blog/{post_id}")
* @Entity("post", expr="repository.find(post_id)")
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand All @@ -171,7 +171,7 @@ This can also be used to help resolve multiple arguments::
* @Route("/blog/{id}/comments/{comment_id}")
* @Entity("comment", expr="repository.find(comment_id)")
*/
public function showAction(Post $post, Comment $comment)
public function show(Post $post, Comment $comment)
{
}

Expand All @@ -193,7 +193,7 @@ A number of ``options`` are available on the ``@ParamConverter`` or
* @Route("/blog/{post_id}")
* @ParamConverter("post", options={"id" = "post_id"})
*/
public function showPostAction(Post $post)
public function showPost(Post $post)
{
}

Expand All @@ -206,7 +206,7 @@ A number of ``options`` are available on the ``@ParamConverter`` or
* @ParamConverter("post", options={"mapping": {"date": "date", "slug": "slug"}})
* @ParamConverter("comment", options={"mapping": {"comment_slug": "slug"}})
*/
public function showCommentAction(Post $post, Comment $comment)
public function showComment(Post $post, Comment $comment)
{
}

Expand All @@ -217,7 +217,7 @@ A number of ``options`` are available on the ``@ParamConverter`` or
* @Route("/blog/{date}/{slug}")
* @ParamConverter("post", options={"exclude": {"date"}})
*/
public function showAction(Post $post, \DateTime $date)
public function show(Post $post, \DateTime $date)
{
}

Expand All @@ -231,7 +231,7 @@ A number of ``options`` are available on the ``@ParamConverter`` or
* @Route("/blog/{id}")
* @ParamConverter("post", options={"entity_manager" = "foo"})
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand All @@ -246,7 +246,7 @@ instance::
/**
* @Route("/blog/archive/{start}/{end}")
*/
public function archiveAction(\DateTime $start, \DateTime $end)
public function archive(\DateTime $start, \DateTime $end)
{
}

Expand All @@ -258,7 +258,7 @@ is accepted. You can be stricter with input given through the options::
* @ParamConverter("start", options={"format": "Y-m-d"})
* @ParamConverter("end", options={"format": "Y-m-d"})
*/
public function archiveAction(\DateTime $start, \DateTime $end)
public function archive(\DateTime $start, \DateTime $end)
{
}

Expand Down
12 changes: 6 additions & 6 deletions Resources/doc/annotations/security.rst
Expand Up @@ -18,7 +18,7 @@ The ``@Security`` and ``@IsGranted`` annotations restrict access on controllers:
*
* @Security("is_granted('ROLE_ADMIN') and is_granted('ROLE_FRIENDLY_USER')")
*/
public function indexAction()
public function index()
{
// ...
}
Expand All @@ -37,7 +37,7 @@ on variables passed to the controller::
* @IsGranted("ROLE_ADMIN")
* @IsGranted("POST_SHOW", subject="post")
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand All @@ -59,7 +59,7 @@ You can also control the message and status code::
*
* @IsGranted("ROLE_ADMIN", statusCode=404, message="Post not found")
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand All @@ -72,7 +72,7 @@ allows you to pass an *expression* that can contains custom logic::
/**
* @Security("is_granted('ROLE_ADMIN') and is_granted('POST_SHOW', post)")
*/
public function showAction(Post $post)
public function show(Post $post)
{
// ...
}
Expand All @@ -98,7 +98,7 @@ exception instead of
/**
* @Security("is_granted('POST_SHOW', post)", statusCode=404)
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand All @@ -107,7 +107,7 @@ The ``message`` option allows you to customize the exception message::
/**
* @Security("is_granted('POST_SHOW', post)", statusCode=404, message="Resource not found.")
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand Down
14 changes: 7 additions & 7 deletions Resources/doc/annotations/view.rst
Expand Up @@ -15,7 +15,7 @@ The ``@Template`` annotation associates a controller with a template name::
/**
* @Template("@SensioBlog/post/show.html.twig")
*/
public function showAction($id)
public function show($id)
{
// get the Post
$post = ...;
Expand All @@ -33,7 +33,7 @@ array of parameters to pass to the view instead of a ``Response`` object.
/**
* @Template(isStreamable=true)
*/
public function showAction($id)
public function show($id)
{
// ...
}
Expand All @@ -49,7 +49,7 @@ case for the above example, you can even omit the annotation value::
/**
* @Template
*/
public function showAction($id)
public function show($id)
{
// get the Post
$post = ...;
Expand All @@ -59,7 +59,7 @@ case for the above example, you can even omit the annotation value::

.. tip::
Sub-namespaces are converted into underscores.
The ``Sensio\BlogBundle\Controller\UserProfileController::showDetailsAction()`` action
The ``Sensio\BlogBundle\Controller\UserProfileController::showDetails()`` action
will resolve to ``@SensioBlog/user_profile/show_details.html.twig``

And if the only parameters to pass to the template are method arguments, you
Expand All @@ -71,7 +71,7 @@ useful in combination with the ``@ParamConverter`` :doc:`annotation
* @ParamConverter("post", class="SensioBlogBundle:Post")
* @Template("@SensioBlog/post/show.html.twig", vars={"post"})
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand All @@ -80,7 +80,7 @@ which, thanks to conventions, is equivalent to the following configuration::
/**
* @Template(vars={"post"})
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand All @@ -91,6 +91,6 @@ attribute is defined::
/**
* @Template
*/
public function showAction(Post $post)
public function show(Post $post)
{
}
8 changes: 4 additions & 4 deletions Resources/doc/index.rst
Expand Up @@ -136,7 +136,7 @@ This example shows all the available annotations in action::
* @Route("/")
* @Template
*/
public function indexAction()
public function index()
{
$posts = ...;

Expand All @@ -152,7 +152,7 @@ This example shows all the available annotations in action::
* @IsGranted("ROLE_SPECIAL_USER")
* @Security("has_role('ROLE_ADMIN') and is_granted('POST_SHOW', post)")
*/
public function showAction(Post $post)
public function show(Post $post)
{
}
}
Expand All @@ -166,7 +166,7 @@ annotations::
* @IsGranted("ROLE_SPECIAL_USER")
* @Security("has_role('ROLE_ADMIN') and is_granted('POST_SHOW', post)")
*/
public function showAction(Post $post)
public function show(Post $post)
{
}

Expand Down Expand Up @@ -205,7 +205,7 @@ snippet::

class DefaultController
{
public function indexAction(ServerRequestInterface $request)
public function index(ServerRequestInterface $request)
{
// Interact with the PSR-7 request

Expand Down