Php Symfony 2基本控制器-返回响应?

Php Symfony 2基本控制器-返回响应?,php,symfony,Php,Symfony,我正在学习Symfony 2,我遇到了以下问题: 我的代码是: public function showListAction() { $ar = $this->getDoctrine() ->getRepository('AcmeHelloBundle:ModGlobalAspectRatio') ->findAll(); return $this->render('AcmeHelloBundl

我正在学习Symfony 2,我遇到了以下问题:

我的代码是:

public function showListAction()
{
    $ar = $this->getDoctrine()
               ->getRepository('AcmeHelloBundle:ModGlobalAspectRatio')
               ->findAll();

    return $this->render('AcmeHelloBundle:Test:showList.html.php', array('recs' => $ar));
}

public function updateAction($id, $name)
{   
    $em = $this->getDoctrine()->getManager();

    $ar = $em->getRepository('AcmeHelloBundle:ModGlobalAspectRatio')->find($id);

    $ar->setName($name);
    $em->flush();

    $content = $this->forward('AcmeHelloBundle:Hello:showList');

    return new Response($content);
}
我在“更新”中运行我的第一个操作“显示列表”

没有
返回新响应()
我有错误:

The controller must return a response (null given). Did you forget to add a return statement somewhere in your controller?
我不明白这是为什么。。这有点愚蠢

我的主要问题是:

为什么使用
后返回新响应
我在页面顶部有文本:

HTTP/1.0 200 OK Cache-Control: no-cache Date: Fri, 28 Feb 2014 19:42:48 GMT X-Debug-Token: f0ada0 X-Debug-Token-Link: /symfony2/web/app_dev.php/_profiler/f0ada0
我不需要这个奇怪的字符串。。我怎样才能删除它


谢谢!!:)

只需返回
$content

public function updateAction($id, $name)
{   
    //...

    $content = $this->forward('AcmeHelloBundle:Hello:showList');

    return $content;
}
编辑:


控制器操作应该返回
响应
对象。当您调用
$this->forward()时
在基本控制器中,它返回所需的
响应
,而控制器操作必须返回该响应。

为什么不使用
return$this->forward('AcmeHelloBundle:Hello:showList')
而不是使用完全无用的
$content
变量?