protected function doExecute(ActionInterface $action, $reprocess = false)
    {
        // The first question is, are we even allowed to reprocess this action?
        $definition = $this->findActionDefinitionByName($action->getName());
        
        if (null == $definition) {
            throw new \RuntimeException(sprintf('Could not load action definition for action %a', $action->getName()));
        }

        $handler = $this->handlers[$definition->getHandlerClass()];

        if ($reprocess) {
            // Delegate to the action handler to see if the action is reprocessable
            $isReprocessable = $handler->isReprocessable($action, $definition);

            if (false == $isReprocessable) {
                throw new \RuntimeException(sprintf('Reprocessing is not allowed for action %a', $action->getName()));
            }
        }

        // Cool, we can process the action!
        $handler->process($action, $definition);
        
        // Save the state of the action
        $this->actionGateway->updateAction($action);
    }
protected function doExecute(ActionInterface $action, $reprocess = false)
    {
        // The first question is, are we even allowed to reprocess this action?
        $definition = $this->findActionDefinitionByName($action->getName());
        
        if (null == $definition) {
            throw new \RuntimeException(sprintf('Could not load action definition for action %a', $action->getName()));
        }

        $handler = $this->handlers[$definition->getHandlerClass()];

        if ($reprocess) {
            // Delegate to the action handler to see if the action is reprocessable
            $isReprocessable = $handler->isReprocessable($action, $definition);

            if (false == $isReprocessable) {
                throw new \RuntimeException(sprintf('Reprocessing is not allowed for action %a', $action->getName()));
            }
        }

        // Cool, we can process the action!
        $handler->process($action, $definition);
        
        // Save the state of the action
        $this->actionGateway->updateAction($action);
    }
protected function doExecute ( ActionInterface $ action , $ reprocess = false ) { // The first question is, are we even allowed to reprocess this action? $ definition = $ this -> findActionDefinitionByName ( $ action -> getName ( ) ) ; if ( null == $ definition ) { throw new \ RuntimeException ( sprintf ( 'Could not load action definition for action %a' , $ action -> getName ( ) ) ) ; } $ handler = $ this -> handlers [ $ definition -> getHandlerClass ( ) ] ; if ( $ reprocess ) { // Delegate to the action handler to see if the action is reprocessable $ isReprocessable = $ handler -> isReprocessable ( $ action , $ definition ) ; if ( false == $ isReprocessable ) { throw new \ RuntimeException ( sprintf ( 'Reprocessing is not allowed for action %a' , $ action -> getName ( ) ) ) ; } } // Cool, we can process the action! $ handler -> process ( $ action , $ definition ) ; // Save the state of the action $ this -> actionGateway -> updateAction ( $ action ) ; }
Start the execution of an action or schedule the action for processing later on

@param ActionInterface $action
@param bool $reprocess
Start the execution of an action or schedule the action for processing later on