/** * {@inheritdoc} */ public function execute(EngineInterface $engine) { $execution = $engine->findExecution($this->executionId); $node = $execution->getProcessModel()->findNode($this->nodeId); $execution->setTimestamp(microtime(true)); $execution->setNode($node); $engine->debug('{execution} entering {node}', ['execution' => (string) $execution, 'node' => (string) $node]); $engine->notify(new EnterNodeEvent($node, $execution)); $this->executeNode($node, $execution); }
/** * {@inheritdoc} */ public function execute(EngineInterface $engine) { $execution = $engine->findExecution(new UUID($this->executionId)); $node = $execution->getNode(); $vars = unserialize($this->variables); $delegation = unserialize($this->delegation); $execution->wakeUp(); $engine->debug('Signaling <{signal}> to {execution}', ['signal' => $this->signal === NULL ? 'NULL' : $this->signal, 'execution' => (string) $execution]); $engine->notify(new SignalNodeEvent($node, $execution, $this->signal, $vars, $delegation)); $this->singalExecution($node, $execution, $vars, $delegation); }
/** * Terminate this path of execution, will also terminate all child executions. * * @param boolean $triggerExecution Trigger / signal parent execution after termination? */ public function terminate($triggerExecution = true) { if ($this->hasState(self::STATE_TERMINATE)) { return; } $this->state |= self::STATE_TERMINATE; $this->syncState = self::SYNC_STATE_REMOVED; $this->engine->debug('Terminate {execution}', ['execution' => (string) $this]); foreach ($this->childExecutions as $execution) { $execution->terminate(false); } if ($triggerExecution) { $this->timestamp = microtime(true); } if ($this->parentExecution === NULL) { $this->engine->notify(new EndProcessEvent($this->node, $this)); } else { $this->parentExecution->childExecutionTerminated($this, $triggerExecution); } }
/** * {@inheritdoc} */ public function execute(EngineInterface $engine) { $execution = $engine->findExecution($this->executionId); if ($execution->isConcurrent()) { if (1 === count($execution->findConcurrentExecutions())) { $parent = $execution->getParentExecution(); foreach ($execution->findChildExecutions() as $child) { $parent->registerChildExecution($child); } $parent->setNode($execution->getNode()); $parent->setTransition($execution->getTransition()); $parent->setTimestamp(microtime(true)); $parent->setActive(true); $parent->markModified(true); $engine->debug('Merged concurrent {execution} into {root}', ['execution' => (string) $execution, 'root' => (string) $parent]); $execution->terminate(false); return $parent->take($this->transitionId); } } $trans = $this->findTransition($execution); if (!$trans->isEnabled($execution)) { if ($execution->isConcurrent() && 0 == count($execution->findConcurrentExecutions())) { $execution->terminate(false); $parent = $execution->getParentExecution(); $parent->setTimestamp(microtime(true)); $parent->setActive(true); $parent->terminate(); } else { $execution->terminate(); } return; } $node = $execution->getNode(); $engine->debug('{execution} leaves {node}', ['execution' => (string) $execution, 'node' => (string) $node]); $engine->notify(new LeaveNodeEvent($node, $execution)); $engine->debug('{execution} taking {transition}', ['execution' => (string) $execution, 'transition' => (string) $trans]); $engine->notify(new TakeTransitionEvent($trans, $execution)); $execution->setTimestamp(microtime(true)); $execution->setTransition($trans); $execution->execute($execution->getProcessModel()->findNode($trans->getTo())); }