【发布时间】:2014-03-17 13:16:17
【问题描述】:
我有一个 Command 类,我想从中调用一个路由来执行控制器。
MyClassCommand extends ContainerAwareCommand
{
protected configure()
{
}
protected execute()
{
}
}
我如何从方法execute()中调用一个路由,它只会调用一个Action?
谢谢
【问题讨论】:
-
你试过
$this->getContainer()->get('router')->generate('route_name', array('foo' => 'text'));吗? -
它不起作用。未定义的方法::get()。服务不暴露
标签: symfony controller console command routes