getSubExecution() public method

If this method is used to resume a subworkflow you must provide the execution id through $id. If $interactive is false an ezcWorkflowExecutionNonInteractive will be returned. This method can be used by nodes implementing sub-workflows to get a new execution environment for the subworkflow.
public getSubExecution ( integer $id = null, boolean $interactive = true ) : ezcWorkflowExecution
$id integer
$interactive boolean
return ezcWorkflowExecution
Ejemplo n.º 1
0
 /**
  * Executes this node.
  *
  * @param ezcWorkflowExecution $execution
  * @return boolean true when the node finished execution,
  *                 and false otherwise
  * @ignore
  */
 public function execute(ezcWorkflowExecution $execution)
 {
     if ($execution->definitionStorage === null) {
         throw new ezcWorkflowExecutionException('No ezcWorkflowDefinitionStorage implementation available.');
     }
     $workflow = $execution->definitionStorage->loadByName($this->configuration['workflow']);
     // Sub Workflow is not interactive.
     if (!$workflow->isInteractive() && !$workflow->hasSubWorkflows()) {
         $subExecution = $execution->getSubExecution(null, false);
         $subExecution->workflow = $workflow;
         $this->passVariables($execution, $subExecution, $this->configuration['variables']['in']);
         $subExecution->start();
     } else {
         // Sub Workflow is to be started.
         if ($this->state == 0) {
             $subExecution = $execution->getSubExecution();
             $subExecution->workflow = $workflow;
             $this->passVariables($execution, $subExecution, $this->configuration['variables']['in']);
             $subExecution->start($execution->getId());
             $this->state = $subExecution->getId();
         } else {
             $subExecution = $execution->getSubExecution($this->state);
             $subExecution->workflow = $workflow;
             $subExecution->resume($execution->getVariables());
         }
     }
     // Execution of Sub Workflow was cancelled.
     if ($subExecution->isCancelled()) {
         $execution->cancel($this);
     }
     // Execution of Sub Workflow has ended.
     if ($subExecution->hasEnded()) {
         $this->passVariables($subExecution, $execution, $this->configuration['variables']['out']);
         $this->activateNode($execution, $this->outNodes[0]);
         $this->state = 0;
         return parent::execute($execution);
     }
     // Execution of Sub Workflow has been suspended.
     foreach ($subExecution->getWaitingFor() as $variableName => $data) {
         $execution->addWaitingFor($this, $variableName, $data['condition']);
     }
     return false;
 }