Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 No route found for "GET /": Method Not Allowed (Allow: POST)

I have two routes defined in in a bundle inside routing.yml and that are:

dm_dashboard:
    pattern:   /
    defaults:  { _controller: DigitalManagerERPBundle:Default:login }
    methods:  [GET]
dm_dashboard:
    pattern:  /
    defaults: { _controller: DigitalManagerERPBundle:Default:processLogin }
    methods:  [POST]

i.e. chose the first route for GET method and chose the second for the POST method. But when I try to get that to path, I am getting this error

No route found for "GET /": Method Not Allowed (Allow: POST)

and none of the routes get executed. Can anyone please tell me what I'm doing wrong here? Why none of the routes executes?

P.S Newbie here

like image 284
Kamran Ahmed Avatar asked Jan 13 '23 00:01

Kamran Ahmed


1 Answers

They have both the same name

Try this:

dm_dashboard_login:
    pattern:   /
    defaults:  { _controller: DigitalManagerERPBundle:Default:login }
    methods:  [GET]
dm_dashboard_process:
    pattern:  /
    defaults: { _controller: DigitalManagerERPBundle:Default:processLogin }
    methods:  [POST]
like image 130
jmoreno Avatar answered Jan 16 '23 22:01

jmoreno