我创建了一个Symfony命令以将记录导入数据库中
现在我正在尝试为此创建一个HMI,但是当我单击按钮执行命令时,浏览器将一直加载到订单结束,,但是我希望真正获得终端信息。时间
我的代码
public function importActesAddUpdateAction(Request $request)
{
//Set max execution time
ini_set('max_execution_time', 3600); //1H
$kernel = $this->get('kernel');
//Get path of project dir
$projectDir = $this->get('kernel')->getProjectDir();
$destination = $projectDir . "/data";
$application = new Application($kernel);
$application->setAutoExit(false);
$input = new ArrayInput(array(
'command' => 'csv:import',
//InputArgument
'path' => $destination, //To directory data
// InputOption
'--add-update' => null,
));
//Configure output
$output = new BufferedOutput(
OutputInterface::VERBOSITY_DEBUG,
true // true for decorated
);
//Run command
$application->run($input, $output);
// return the output
$converter = new AnsiToHtmlConverter();
$content = $output->fetch();
return new Response($converter->convert($content));
}
谢谢!