Search code examples
phpsymfony-2.1

The controller for URI is not callable symfony2


i get this error [enter image description here][1] i have in my project 2 bundles the first one is working just fine the seconde is called DemandeBundle i get the error

namespace DemandeBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class DefaultController extends Controller
{
/**
 * @return \Symfony\Component\HttpFoundation\Response
 * @route("/homedemande",name="homedemande")
 */
public function indexAction()
{
    return $this->render('@DemandeBundle/Default/index.html.twig');
}

/**
 * @return \Symfony\Component\HttpFoundation\Response
 * @route("/demande_create",name="demande_create")
 */
public function demande_create()
{
    return $this->render('@DemandeBundle/Default/demande_create.html.twig');
}
}

i suspect i have a problem in routing.yml

demande_create:
path:     /demande_create
defaults: { _controller: DemandeBundle:Default:demande_create}

Solution

  • your action needs to be suffixed with Action keyword to be callable that is probably the first issue here

    function definition should be something like

    public function demande_createAction()