Symfony 在另一个包中调用一个包

Symfony call a bundle in an other bundle

我试图在我的主包中调用我的一个包的方法,但是 returns 我出错了。我肯定做错了什么,但我不知道是什么。

错误:

Call to a member function has() on null

我的 MainBundle 中的代码,调用我的 ReviewBundle:

public function indexAction()
{
        $reviewController = new \ReviewBundle\Controller\DefaultController();
        $reviews = $reviewController->listAction();
        return new Response($reviews);
}

listAction 应该已经 return 一个响应,所以 return 它 :

public function indexAction()
{
        $reviewController = new \ReviewBundle\Controller\DefaultController();
        $reviews = $reviewController->listAction();
        return $reviews;
}