From d13177274ddbdfbb43331fd6137c0de1d555bcd9 Mon Sep 17 00:00:00 2001 From: Christopher Hertel Date: Mon, 25 Mar 2019 16:57:50 +0100 Subject: [PATCH] removing action-suffix for contoller actions --- Resources/doc/annotations/cache.rst | 10 +++++----- Resources/doc/annotations/converters.rst | 24 ++++++++++++------------ Resources/doc/annotations/security.rst | 12 ++++++------ Resources/doc/annotations/view.rst | 14 +++++++------- Resources/doc/index.rst | 8 ++++---- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Resources/doc/annotations/cache.rst b/Resources/doc/annotations/cache.rst index 886526dd..247d17cb 100644 --- a/Resources/doc/annotations/cache.rst +++ b/Resources/doc/annotations/cache.rst @@ -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() { } @@ -39,7 +39,7 @@ configuration, the latter overrides the former:: /** * @Cache(expires="+2 days") */ - public function indexAction() + public function index() { } } @@ -64,7 +64,7 @@ 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 @@ -72,7 +72,7 @@ response is not modified (in this case, the controller is **not** called):: 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()); @@ -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, ...). \ No newline at end of file + smaxage, maxage and maxstale attributes can also get a string with relative time format (1 day, 2 weeks, ...). diff --git a/Resources/doc/annotations/converters.rst b/Resources/doc/annotations/converters.rst index 9bcafe6a..8ff3eaba 100644 --- a/Resources/doc/annotations/converters.rst +++ b/Resources/doc/annotations/converters.rst @@ -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) { } @@ -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) { } @@ -114,7 +114,7 @@ the converter will automatically fetch them:: * * @Route("/blog/{id}") */ - public function showByPkAction(Post $post) + public function showByPk(Post $post) { } @@ -123,7 +123,7 @@ the converter will automatically fetch them:: * * @Route("/blog/{slug}") */ - public function showAction(Post $post) + public function show(Post $post) { } @@ -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) { } @@ -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) { } @@ -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) { } @@ -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) { } @@ -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) { } @@ -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) { } @@ -246,7 +246,7 @@ instance:: /** * @Route("/blog/archive/{start}/{end}") */ - public function archiveAction(\DateTime $start, \DateTime $end) + public function archive(\DateTime $start, \DateTime $end) { } @@ -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) { } diff --git a/Resources/doc/annotations/security.rst b/Resources/doc/annotations/security.rst index ece7004e..3bd40bcc 100644 --- a/Resources/doc/annotations/security.rst +++ b/Resources/doc/annotations/security.rst @@ -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() { // ... } @@ -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) { } @@ -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) { } @@ -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) { // ... } @@ -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) { } @@ -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) { } diff --git a/Resources/doc/annotations/view.rst b/Resources/doc/annotations/view.rst index eb1ba83c..118f815c 100644 --- a/Resources/doc/annotations/view.rst +++ b/Resources/doc/annotations/view.rst @@ -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 = ...; @@ -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) { // ... } @@ -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 = ...; @@ -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 @@ -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) { } @@ -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) { } @@ -91,6 +91,6 @@ attribute is defined:: /** * @Template */ - public function showAction(Post $post) + public function show(Post $post) { } diff --git a/Resources/doc/index.rst b/Resources/doc/index.rst index fb1215f5..b444ff7f 100644 --- a/Resources/doc/index.rst +++ b/Resources/doc/index.rst @@ -136,7 +136,7 @@ This example shows all the available annotations in action:: * @Route("/") * @Template */ - public function indexAction() + public function index() { $posts = ...; @@ -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) { } } @@ -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) { } @@ -205,7 +205,7 @@ snippet:: class DefaultController { - public function indexAction(ServerRequestInterface $request) + public function index(ServerRequestInterface $request) { // Interact with the PSR-7 request