public function onConsoleCommand(ConsoleCommandEvent $event)
    {
        if (!$this->processRepository->createSchemaIfNotExists()) {
            throw new Exception('Cannot create schema for ConsoleProcessManagerBundle');
        }

        $argv = $_SERVER['argv'];
        unset($argv[0]);
        $command = implode(' ', $argv);

        if (!$process = $this->processRepository->findOneByCommand($command)) {
            $commandName = $event->getCommand()->getName();
            $process = $this->processRepository->createProcess($commandName, $command);
        }

        $call = new Call();
        $call->setStatus(Call::STATUS_STARTED);
        $call->setConsolePid($this->getPid());

        $this->processRepository->addCallToProcess($process, $call);

        $process->setLastCall($call);
        $this->processRepository->update($process);

        $_REQUEST['call_id'] = $call->getId();
    }
public function onConsoleCommand(ConsoleCommandEvent $event)
    {
        if (!$this->processRepository->createSchemaIfNotExists()) {
            throw new Exception('Cannot create schema for ConsoleProcessManagerBundle');
        }

        $argv = $_SERVER['argv'];
        unset($argv[0]);
        $command = implode(' ', $argv);

        if (!$process = $this->processRepository->findOneByCommand($command)) {
            $commandName = $event->getCommand()->getName();
            $process = $this->processRepository->createProcess($commandName, $command);
        }

        $call = new Call();
        $call->setStatus(Call::STATUS_STARTED);
        $call->setConsolePid($this->getPid());

        $this->processRepository->addCallToProcess($process, $call);

        $process->setLastCall($call);
        $this->processRepository->update($process);

        $_REQUEST['call_id'] = $call->getId();
    }
public function onConsoleCommand ( ConsoleCommandEvent $ event ) { if ( ! $ this -> processRepository -> createSchemaIfNotExists ( ) ) { throw new Exception ( 'Cannot create schema for ConsoleProcessManagerBundle' ) ; } $ argv = $ _SERVER [ 'argv' ] ; unset ( $ argv [ 0 ] ) ; $ command = implode ( ' ' , $ argv ) ; if ( ! $ process = $ this -> processRepository -> findOneByCommand ( $ command ) ) { $ commandName = $ event -> getCommand ( ) -> getName ( ) ; $ process = $ this -> processRepository -> createProcess ( $ commandName , $ command ) ; } $ call = new Call ( ) ; $ call -> setStatus ( Call :: STATUS_STARTED ) ; $ call -> setConsolePid ( $ this -> getPid ( ) ) ; $ this -> processRepository -> addCallToProcess ( $ process , $ call ) ; $ process -> setLastCall ( $ call ) ; $ this -> processRepository -> update ( $ process ) ; $ _REQUEST [ 'call_id' ] = $ call -> getId ( ) ; }
Run on console command start

@param ConsoleCommandEvent $event
@throws Exception
Run on console command start