Пример #1
0
 public function build()
 {
     $model = $this->builder->build();
     $linkCatch = [];
     $linkThrow = [];
     foreach ($model->findNodes() as $node) {
         $behavior = $node->getBehavior();
         if ($behavior instanceof IntermediateLinkCatchBehavior) {
             $linkCatch[$behavior->getLink()] = $node->getId();
         }
         if ($behavior instanceof IntermediateLinkThrowBehavior) {
             $linkThrow[$node->getId()] = $behavior->getLink();
         }
     }
     if (!empty($linkCatch)) {
         foreach ($linkThrow as $nodeId => $link) {
             if (empty($linkCatch[$link])) {
                 throw new \RuntimeException(sprintf('No link catch event defined for link "%s" thrown by node %s', $link, $nodeId));
             }
             // This does the trick: insert a new transition directly connecting the link events.
             $trans = new Transition('link-' . UUID::createRandom(), $nodeId);
             $trans->to($linkCatch[$link]);
             $model->addItem($trans);
         }
     }
     return $model;
 }
Пример #2
0
 /**
  * Compute current sync data from execution state.
  * 
  * @return array
  */
 public function collectSyncData()
 {
     $data = ['id' => $this->id, 'parentId' => $this->parentExecution === NULL ? NULL : $this->parentExecution->getId(), 'processId' => $this->getRootExecution()->getId(), 'modelId' => $this->model->getId(), 'state' => $this->state, 'depth' => $this->getExecutionDepth(), 'timestamp' => $this->timestamp, 'variables' => $this->variables, 'transition' => $this->transition === NULL ? NULL : (string) $this->transition->getId(), 'node' => $this->node === NULL ? NULL : (string) $this->node->getId()];
     return $data;
 }
Пример #3
0
 /**
  * Have the execution transition into the next node.
  * 
  * @param Execution $execution
  * @param Transition $transition
  */
 public function __construct(Execution $execution, Transition $transition = NULL)
 {
     $this->executionId = $execution->getId();
     $this->transitionId = $transition === NULL ? NULL : (string) $transition->getId();
 }