ログイン後にカスタム symfony2 コンソール コマンド バックグラウンドを実行したいと考えています。リスナーを作成し、プロセスを使用してバックグラウンドでコマンドを実行しようとしましたが、機能がうまく機能しません。これが私のコードです
class LoginListener
{
protected $doctrine;
private $RecommendJobService;
public function __construct(Doctrine $doctrine)
{
$this->doctrine = $doctrine;
}
public function onLogin(InteractiveLoginEvent $event)
{
$user = $event->getAuthenticationToken()->getUser();
if($user)
{
$process = new Process('ls -lsa');
$process->start(function ($type, $buffer) {
$command = $this->RecommendJobService;
$input = new ArgvInput();
$output = new ConsoleOutput();
$command->execute($input, $output);
echo "1";
});
}
}
public function setRecommendJobService($RecommendJobService) {
$this->RecommendJobService = $RecommendJobService;
}
}
私のコードに何か問題がありますか? 助けてくれてありがとう。