Symfony2 - “This-> Forward”指向外部文件夹

时间:2013-12-13 19:12:54

标签: symfony forward

我需要找到将位于外部文件夹中的控制器转发到捆绑驱动程序的方法。

我试图以不同的方式做到这一点,但没有一个对那个驱动程序。

$response = $this->forward
('MiBundle/Api/Subfolder/Controller/Test::index');
return $response;

示例:

MyBundle
 -Api
   -Subfolder
     -Controller 
       -TestController.php (Forward Target)
 -Controller
 -Entity
 -Form
 -Resources
 -Security
 -Services
 -Tests

任何人都可以帮我一把吗?

谢谢。

1 个答案:

答案 0 :(得分:0)

尝试使用完整路径,所以在这里:

$response = $this->forward('AcmeHelloBundle:Hello:fancy', array(
        'name'  => $name,
        'color' => 'green',
    ));

...也就是说,使用捆绑包的名称。