/**
  * {@inheritdoc}
  */
 public function execute(Execution $execution)
 {
     $execution->getEngine()->notify(new ActivityStartedEvent($this->activityId, $execution, $execution->getEngine()));
     $execution->getEngine()->info('ENTER: scope <{scope}> at level {level} using {execution}', ['scope' => $this->activityId, 'level' => $execution->getExecutionDepth(), 'execution' => (string) $execution]);
     $root = $execution->createNestedExecution($execution->getProcessModel(), $execution->getNode(), true);
     $root->waitForSignal();
     $this->createEventSubscriptions($root, $this->activityId, $execution->getNode());
     $this->enter($root->createExecution(false));
 }
 /**
  * {@inheritdoc}
  */
 public function execute(Execution $execution)
 {
     $nodes = $this->process->findInitialNodes();
     if (count($nodes) !== 1) {
         throw new \RuntimeException(sprintf('No single start node found in process "%s"', $this->process->getTitle()));
     }
     $startNode = array_shift($nodes);
     $sub = $execution->createNestedExecution($this->process, $startNode, true, $this->isolateScope);
     foreach ($this->inputs as $target => $source) {
         if ($execution->hasVariable($source)) {
             $sub->setVariable($target, $execution->getVariable($source));
         }
     }
     $execution->waitForSignal();
     $sub->execute($startNode);
 }