Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Troubleshooting "The controller for URI is not callable" error

Tags:

routes

symfony

I'm working on Symfony 2.3 and I declared a new route and new controller, but when I call this controller from the browser I get this error:

The controller for URI "/user/1" is not callable. in /dev.mydomain.org/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php at line 82

This is my simple route configuration:

user_homepage:     pattern:  /user     defaults: { _controller: UserBundle:Default:index }      user_show:     pattern:  /user/{id}     defaults: { _controller: UserBundle:Default:show }     requirements:         id:  \d+ 

And this is my very simple controller:

public function showUserAction($id) {             return $this->render('UserBundle:Default:show.html.twig', array()); } 

What is wrong?

like image 939
Angelo Giuffredi Avatar asked Jul 30 '13 09:07

Angelo Giuffredi


Video Answer


1 Answers

The logical name UserBundle:Default:show refers to UserBunde\Controller\DefaultController::showAction you have a method called showUserAction.

Either change the method name to showAction or change the logical name to UserBundle:Default:showUser.

like image 194
Wouter J Avatar answered Sep 18 '22 10:09

Wouter J