我在我的控制器中使用了这个片段
$app = new Application($this->container->get('kernel'));
$input = new StringInput('generate:doctrine:entity --no-interaction --entity=ModelBundle:MyTest --fields="title:string(100)"');
$output = new StreamOutput(fopen('php://temp', 'w'));
$app->doRun($input, $output);
它触发了错误"错误:超过了30秒的最大执行时间",我将最大执行时间增加到100,但仍然得到相同的错误。
我在CLI中尝试了同样的命令,效果很好。
我在我的控制器中用容器替换了命令generate:doctory:entity:debug,但我没有得到错误"Maximum execution time"。
$input = new StringInput('container:debug');
我正在使用Symfony 2.6.1
有什么提示吗?
也许您正在调用的命令需要一些用户输入。
不确定你想做什么,但你试过简单的exec()或passthru()调用吗?