2021年1月6日星期三

No route found for "POST ...": Method Not Allowed (Allow: PUT)

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);      }  

ArticleSearchType.php

            // Article type              $articleType = "";              if (isset($data["articleType"]) && in_array($data["articleType"], Parameters::getArticleTypeKeys())) {                  $articleType = $data["articleType"];              }              $data["articleType"] = $articleType;                // Article Status              $articleStatus = "";              if (isset($data["articleStatus"]) && in_array($data["articleStatus"], Parameters::getArticleStatusKeys())) {                  $articleStatus = $data["articleStatus"];              }              $data["articleStatus"] = $articleStatus;                $event->setData($data);        /**       * {@inheritdoc}       */      public function buildView(FormView $view, FormInterface $form, array $options)      {          $loginStaff = $options['login_staff'];          $shop = $options['login_staff']->getShop();            // Valid article status          if ($loginStaff->isHq() or $shop->getApprovalFlg()) {              // Headquarters management screen or shop management screen with approval flag enabled              $view->vars["enabledArticleStatus"] = array(                  "" => "all",                  "draft" => "draft",                  "pending" => "pending",                  "reject" => "reject",                  "publish" => "publish",                  "hidden" => "hidden",              );          } else {              // Shop management screen with invalid approval flag              $view->vars["enabledArticleStatus"] = array(                  "" => "all",                  "draft" => "draft",                  "publish" => "publish",                  "hidden" => "hidden",              );          }      }  

index.html.twig

{# Toolbar #}      Liquid error: Unknown operator modal  

Version

Cent OS 6.7 PHP 5.6 Symfony3.0.9

https://stackoverflow.com/questions/65539655/no-route-found-for-post-method-not-allowed-allow-put January 02, 2021 at 09:36PM

没有评论:

发表评论