php - No route found, Symfony routing not updating properly -


my routing.yml:

user_user:     resource: "@useruserbundle/resources/config/routing.yml"     prefix:   /user  book_book:     resource: "@bookbookbundle/resources/config/routing.yml"     prefix:   /book  index_index:     resource: "@indexindexbundle/resources/config/routing.yml"     prefix:   /   app:     resource: "@appbundle/controller/"     type:     annotation  fos_user:     resource: "@fosuserbundle/resources/config/routing/all.xml"  app_api:     resource: "@appbundle/controller/api"     type:     annotation  mvms_api:     type:     rest     prefix:   /api     resource: "@appbundle/resources/config/api-routing.yml" 

my

api-routing.yml:

blog_api_articles:     type: rest     resource: "@appbundle/controller/articlescontroller.php"     name_prefix:  api_article_   blog_api_reviews:     type: rest     resource: "@appbundle/controller/reviewscontroller.php"     name_prefix:  api_reviews_   api_reviewsput:     type: rest     resource: "@appbundle/controller/putcontroller.php"     name_prefix:  api_put_ 

my php bin/console debug:router

...   api_article_get_article                            /api/articles/{id}.{_format}   api_reviews_get_review                             /api/reviews/{id}.{_format} 

the last entry in api-routing doesn't appear working/showing ...

//this works fine     class reviewscontroller extends controller {      /**      * note: here name important      * => action restricted http method      * article => (without s) generate /articles/something      * action => standard things symfony controller method      *           generate output      *      * generates route .../articles/{id}      */     public function getreviewaction($id)     {              $someid = $id;             $rv = $this->getdoctrine()->getmanager();             $review = $rv->createquery(                 'select *  appbundle:something r r.id= :id')->setparameter('id', $someid);              $reviews = $review->getresult();         if (empty($reviews)) {             return array('data' => 'none');         }         else             return $reviews;     }     }   class putcontroller {     public function putreviewsput($id)     {          $someid = $id;         $rv = $this->getdoctrine()->getmanager();         $review = $rv->createquery(             'some query')->setparameter('id', $someid);          $reviews = $review->getresult();         if (empty($reviews)) {             return array('data' => 'none');         }         else             return $reviews;     } } 

when enter new routes in api-routing.yml app doesn't bother take them account. i'm getting "no route found \"get /api/put/1\"", in postman

i tried restarting server , tried php bin/console cache:clear --env prod

running xampp on windows 10 , using phpstorm editor.

i having same issue last night api_reviews_ somehow decided work.

you should use suffix action in controller method.

so try this:

class putcontroller {     public function putreviewsputaction($id)     { 

instead of this:

class putcontroller {     public function putreviewsput($id)     { 

hope help


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -