在Symfony找不到“GET / formulari”的路线

时间:2017-08-07 08:20:00

标签: php symfony routing

我正在尝试用Symfony做一个简单的处方集,但我不知道它为什么找不到我的路线(/ formulari)。

这是我在src / AppBundle / Controller / PersonsController.php中的函数

/**
 * Route("/formulari", name="formulari")
 * @param Request $request
 * @return string
 */
public function newAction(Request $request)
{
    // crea una task y le asigna algunos datos ficticios para este ejemplo
    $task = new Task();
    $task->setTask('Write a blog post');
    $task->setDueDate(new \DateTime('tomorrow'));

    $form = $this->createFormBuilder($task)
        ->add('task', 'text')
        ->add('dueDate', 'date')
        ->add('save', 'submit')
        ->getForm();

    return $this->render('AppBundle::formulari.html.twig', [
        'list' => $form
    ]);
}

这是formulari.twig.html文件:

{% extends 'base.html.twig' %}

{{ form(form) }}

这是错误:

  

NotFoundHttpException   Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException:无路由   找到“GET / formulari”

     

在   供应商/ symfony的/ symfony的/ SRC / Symfony的/组件/ HttpKernel /事件监听/ RouterListener.php:125   在   的Symfony \组件\ HttpKernel \事件监听\ RouterListener-> onKernelRequest(对象(GetResponseEvent),   'kernel.request',对象(TraceableEventDispatcher))at   call_user_func(array(object(RouterListener),'onKernelRequest'),   object(GetResponseEvent),'kernel.request',   对象(TraceableEventDispatcher))        (供应商/ symfony的/ symfony的/ SRC / Symfony的/组件/此事件/调试/ WrappedListener.php:104)   在   的Symfony \组件\此事件\调试\ WrappedListener-> __调用(对象(GetResponseEvent),   'kernel.request',object(ContainerAwareEventDispatcher))at   call_user_func(object(WrappedListener),object(GetResponseEvent),   'kernel.request',object(ContainerAwareEventDispatcher))        (供应商/ symfony的/ symfony的/ SRC / Symfony的/组件/此事件/ EventDispatcher.php:212)   在   的Symfony \组件\此事件\ EventDispatcher-> doDispatch(阵列(对象(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener),object(WrappedListener),   object(WrappedListener)),'kernel.request',object(GetResponseEvent))        (供应商/ symfony的/ symfony的/ SRC / Symfony的/组件/此事件/ EventDispatcher.php:44)   在   的Symfony \组件\此事件\ EventDispatcher->调度( 'kernel.request',   对象(GetResponseEvent))        (供应商/ symfony的/ symfony的/ SRC / Symfony的/组件/此事件/调试/ TraceableEventDispatcher.php:146)   在   的Symfony \组件\此事件\调试\ TraceableEventDispatcher->调度( 'kernel.request',   对象(GetResponseEvent))        (供应商/ symfony的/ symfony的/ SRC / Symfony的/组件/ HttpKernel / HttpKernel.php:129)   在Symfony \ Component \ HttpKernel \ HttpKernel-> handleRaw(object(Request),   1)        (供应商/ symfony的/ symfony的/ SRC / Symfony的/组件/ HttpKernel / HttpKernel.php:68)   在Symfony \ Component \ HttpKernel \ HttpKernel->句柄(对象(请求),1,   真正)        (供应商/ symfony的/ symfony的/ SRC / Symfony的/组件/ HttpKernel / Kernel.php:171)   在Symfony \ Component \ HttpKernel \ Kernel->句柄(对象(请求))        (网络/ app_dev.php:29)

0 个答案:

没有答案