I have the following in my app/frontend/config/routing.yml
:
homepage: url: / param: { module: main, action: index } default_index: url: /:module param: { action: index } default: url: /:module/:action/* sf_guard_register: url: /register param: { module: user, action: register } sf_guard_signin: url: /login param: { module: sfGuardAuth, action: signin } sf_guard_signout: url: /logout param: { module: sfGuardAuth, action: signout } sf_guard_password: url: /request_password param: { module: sfGuardAuth, action: password }
When I try the /register
route, I get this:
Action "register/index" does not exist.
I should specify, I don't have a "register" module, and my user module is working well if called manually. Plus the other routes are working fine.
Any ideas are welcomed, thank you!
In line with jeremy's answer:
Because your default_index
route is placed above, going to /register
causes this route to match. Since it is located before the sf_guard_register
route, only the first match "counts".
Your routing.yml should look like this:
sf_guard_register:
url: /register
param: { module: user, action: register }
sf_guard_signin:
url: /login
param: { module: sfGuardAuth, action: signin }
sf_guard_signout:
url: /logout
param: { module: sfGuardAuth, action: signout }
sf_guard_password:
url: /request_password
param: { module: sfGuardAuth, action: password }
homepage:
url: /
param: { module: main, action: index }
default_index:
url: /:module
param: { action: index }
default:
url: /:module/:action/*
Also, there are a number of best-practises that you might want to follow:
@homepage
is faster than having symfony figure out which route to match when using url_for
or link_to
helpers. Therefore, disable the default routing and create the routes yourself. Then, use the name of the route when generating URLs.sf_guard_register
at the top.Just my 5 cents - hope you find it useful ;-)