addWaitingFor() public method

Adds a variable that an (input) node is waiting for.
public addWaitingFor ( ezcWorkflowNode $node, string $variableName, ezcWorkflowCondition $condition )
$node ezcWorkflowNode
$variableName string
$condition ezcWorkflowCondition
Exemplo 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)
 {
     $variables = $execution->getVariables();
     $canExecute = true;
     $errors = array();
     foreach ($this->configuration as $variable => $condition) {
         if (!isset($variables[$variable])) {
             $execution->addWaitingFor($this, $variable, $condition);
             $canExecute = false;
         } else {
             if (!$condition->evaluate($variables[$variable])) {
                 $errors[$variable] = (string) $condition;
             }
         }
     }
     if (!empty($errors)) {
         throw new ezcWorkflowInvalidInputException($errors);
     }
     if ($canExecute) {
         $this->activateNode($execution, $this->outNodes[0]);
         return parent::execute($execution);
     } else {
         return false;
     }
 }