简体   繁体   English

URI的控制器不可调用symfony2

[英]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 我收到此错误[在此处输入图片描述] [1]我在我的项目2包中有一个,第一个正在正常工作,第二个被称为DemandeBundle,我收到了错误

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 我怀疑我在routing.yml中有问题

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

your action needs to be suffixed with Action keyword to be callable that is probably the first issue here 您的操作需要后缀Action关键字才能被调用,这可能是这里的第一个问题

function definition should be something like 函数定义应类似于

public function demande_createAction()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM