src/Command/TakeTransitionCommand.php
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()));
    }
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()));
    }
{@inheritdoc}