getParentThreadId() public method

Returns the id of the parent thread for a given thread.
public getParentThreadId ( integer $threadId ) : integer
$threadId integer The id of the thread for which to return the parent thread id.
return integer
Ejemplo n.º 1
0
 /**
  * Prepares this node for activation.
  *
  * @param ezcWorkflowExecution $execution
  * @param int $threadId
  * @throws ezcWorkflowExecutionException
  */
 protected function prepareActivate(ezcWorkflowExecution $execution, $threadId = 0)
 {
     $parentThreadId = $execution->getParentThreadId($threadId);
     if ($this->state['siblings'] == -1) {
         $this->state['siblings'] = $execution->getNumSiblingThreads($threadId);
     } else {
         foreach ($this->state['threads'] as $oldThreadId) {
             if ($parentThreadId != $execution->getParentThreadId($oldThreadId)) {
                 throw new ezcWorkflowExecutionException('Cannot synchronize threads that were started by different branches.');
             }
         }
     }
     $this->state['threads'][] = $threadId;
 }
Ejemplo n.º 2
0
 /**
  * Activate this node.
  *
  * @param ezcWorkflowExecution $execution
  * @param ezcWorkflowNode $activatedFrom
  * @param int $threadId
  * @ignore
  */
 public function activate(ezcWorkflowExecution $execution, ezcWorkflowNode $activatedFrom = null, $threadId = 0)
 {
     $parentThreadId = $execution->getParentThreadId($threadId);
     if (empty($this->state['threads'])) {
         $this->state['threads'][] = $threadId;
         parent::activate($execution, $activatedFrom, $parentThreadId);
     }
 }