私はSymfony 2で作業していますが、小さな問題ソルバーバンドルを作成しようとしています。コントローラーで実行されたコマンドから例外をスローする
私はretry
フィールドを含むエンティティProblem
を持っています。このフィールドには、以前に失敗したものを再試行するために実行するコマンドに関する情報が含まれています。だからここ
は私のコントローラのコードです:
public function retryAction($id)
{
$em = $this->getDoctrine()->getManager();
$problem = $em->getRepository('RBLogsBundle:Problem')->find($id);
$kernel = $this->get('kernel');
$application = new Application($kernel);
$application->setAutoExit(false);
$input = new ArrayInput($problem->getRetry());
$output = new BufferedOutput();
$application->run($input,$output);
$content = $output->fetch();
return new Response($content);
}
私のコマンドが失敗すると、それが通常は例外をスローします。しかし、ここでは、コマンド中にスローされた例外がコマンドを停止するように見えますが、コントローラの実行は継続します。
コントローラでコマンドが正常終了したかどうかをどのように知ることができますか?
、私が持っている唯一の解決策は、 '[例外]' '文字列をoutput'で見ているが、それはそう感じているので、悪い習慣... – Hammerbot