Search code examples
symfonyroutessymfony-2.3

Symfony2: Exception - Unable to find the controller for path


I added a new action to my controller, created the twig file and added the corresponding route to the routing.yml file. However I can't make it work. I keep getting:

Unable to find the controller for path /route/1/change

What am I missing?

# app/config/routing.yml

engineering_change:
    pattern: /engineering/{id}/change
    defaults: { controller: MgmtBundle:Engineering:change }

I generate the url in my template like this:

{{ path('engineering_change', { 'id': entities.id }) }}

Solution

  • It should read _controller instead of controller in your routing.yml.

    -> Routing in Action