skip to Main Content

Currently, I am updating the system running on the existing Symfony 2.3 (currently 3.0.9), and checking the operation.
When I tried to change the state of an item to the selected state, I got an error.
Do you have any advice for determining the case?

Error Code

No route found for "POST /admin/hq/article/3999/articleStatus": 
Method Not Allowed (Allow: PUT)

Code

ArticleController.php

    /**
     * Article status change
     *
     * @Method("PUT")
     * @Route("/article/{ids}/articleStatus")
     * @Secure(roles="ROLE_HQ_MANAGE")
     */
    public function updateArticleStatusAction(Request $request, $ids)
    {
        return parent::updateArticleStatusAction($request, $ids);
    }

Version

CentOS 6.7
PHP 5.6
Symfony3.0.9

2

Answers


  1. I’m guessing you are using a web browser to submit a form and the action goes to /admin/hq/article/3999/articleStatus which only allows PUT operations (because of the @Method("PUT") annotation). Wheras submitting a form with a browser is a POST operation. Change that line to @Method("POST") and you should be fine.

    Login or Signup to reply.
  2. Go vendor/symfony/http-foundation/Request.php and check line 80 in Symfony 6.2 and change this value from false to true

    protected static $httpMethodParameterOverride = true;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search