private function hasFailed(TaskExecutionInterface $execution, \Exception $exception)
    {
        // this find is necessary because the storage could be
        // invalid (clear in doctrine) after handling an execution.
        $execution = $this->taskExecutionRepository->findByUuid($execution->getUuid());
        $execution->setException($exception->__toString());
        $execution->setStatus(TaskStatus::FAILED);

        $this->eventDispatcher->dispatch(
            Events::TASK_FAILED,
            new TaskExecutionEvent($execution->getTask(), $execution)
        );

        return $execution;
    }
private function hasFailed(TaskExecutionInterface $execution, \Exception $exception)
    {
        // this find is necessary because the storage could be
        // invalid (clear in doctrine) after handling an execution.
        $execution = $this->taskExecutionRepository->findByUuid($execution->getUuid());
        $execution->setException($exception->__toString());
        $execution->setStatus(TaskStatus::FAILED);

        $this->eventDispatcher->dispatch(
            Events::TASK_FAILED,
            new TaskExecutionEvent($execution->getTask(), $execution)
        );

        return $execution;
    }
private function hasFailed ( TaskExecutionInterface $ execution , \ Exception $ exception ) { // this find is necessary because the storage could be // invalid (clear in doctrine) after handling an execution. $ execution = $ this -> taskExecutionRepository -> findByUuid ( $ execution -> getUuid ( ) ) ; $ execution -> setException ( $ exception -> __toString ( ) ) ; $ execution -> setStatus ( TaskStatus :: FAILED ) ; $ this -> eventDispatcher -> dispatch ( Events :: TASK_FAILED , new TaskExecutionEvent ( $ execution -> getTask ( ) , $ execution ) ) ; return $ execution ; }
The given task failed the run.

@param TaskExecutionInterface $execution
@param \Exception $exception

@return TaskExecutionInterface
The given task failed the run .