I generated a bundle but I receive error trying to access url http://localhost/app_dev.php/event:
No route found for "GET /event"
then I debugged the router with debug:router, and the router seems to be fine:
event_homepage ANY ANY ANY
/hello/{firstName}/{count}
event_index GET ANY ANY /event/
event_show GET ANY ANY /event/{id}/show
event_new GET|POST ANY ANY /event/new
event_edit GET|POST ANY ANY /event/{id}/edit
event_delete DELETE ANY ANY /event/{id}/delete
after I have created the bundle automatically I had this error:
[ERROR] The bundle's "Resources/config/routing.yml" file cannot be imp
orted
from "app/config/routing.yml" because the "EventBundle" bundle is
already imported. Make sure you are not using two different
configuration/routing formats in the same bundle because it won't work
Below is all the routing structure files:
/home/stefano/starwarsevents/app/config/routing.yml
event:
resource: "@EventBundle/Resources/config/routing.yml"
prefix: /
/home/stefano/starwarsevents/src/EventBundle/Resources/config/routing.yml
event_homepage:
path: /hello/{firstName}/{count}
defaults: { _controller: EventBundle:Default:index }
event_event:
resource: "@EventBundle/Resources/config/routing/event.yml"
prefix: /event
/home/stefano/starwarsevents/src/EventBundle/Resources/config/routing/event.yml
event_index:
path: /
defaults: { _controller: "EventBundle:Event:index" }
methods: GET
event_show:
path: /{id}/show
defaults: { _controller: "EventBundle:Event:show" }
methods: GET
event_new:
path: /new
defaults: { _controller: "EventBundle:Event:new" }
methods: [GET, POST]
event_edit:
path: /{id}/edit
defaults: { _controller: "EventBundle:Event:edit" }
methods: [GET, POST]
event_delete:
path: /{id}/delete
defaults: { _controller: "EventBundle:Event:delete" }
methods: DELETE
Slashes are counted and required. To help with this, I've put this RedirectingController in my codebase as a (nearly) final route, to catch and redirect to the slash-less version, should it happen.
But in the meantime the URL is currently /event/
, not /event
. You could also put the alternate one in as an alternate route to the same place.