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; } /** * Performs the merge by ending the incoming threads and * activating the outgoing node. * * @param ezcWorkflowExecution $execution */ protected function doMerge( ezcWorkflowExecution $execution ) { foreach ( $this->state['threads'] as $threadId ) { $execution->endThread( $threadId ); } $this->activateNode( $execution, $this->outNodes[0] ); $this->initState(); return parent::execute( $execution ); } /** * Initializes the state of this node. */ protected function initState() { $this->state = array( 'threads' => array(), 'siblings' => -1 ); } } ?>