ezcWorkflowExecution::getNumSiblingThreads PHP Method

getNumSiblingThreads() public method

Returns the number of siblings for a given thread.
public getNumSiblingThreads ( integer $threadId ) : integer
$threadId integer The id of the thread for which to return the number of siblings.
return integer
    public function getNumSiblingThreads($threadId)
    {
        if (isset($this->threads[$threadId])) {
            return $this->threads[$threadId]['numSiblings'];
        } else {
            return false;
        }
    }

Usage Example

Esempio 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;
 }