Example #1
0
 /**
  * Get a copy of a task from the workflow
  *
  * @param WorkflowInterface $workflow
  * @param string            $activity_name    The activity name we're looking for
  * @param string            $activity_version Optionally provide the activity version
  * @return TaskSchema
  */
 protected function getTask(WorkflowInterface $workflow, $activity_name, $activity_version = null)
 {
     foreach ($workflow->getTasks() as $task) {
         if ($task->getActivityName() == $activity_name) {
             if ($activity_version !== null) {
                 if ($task->getActivityVersion() == $activity_version) {
                     return clone $task;
                 }
             } else {
                 return clone $task;
             }
         }
     }
     throw new NotFoundException("Task '" . $activity_name . "' not found");
 }
 /**
  * Get a (jailed) memory pool matching this workflow execution
  *
  * @param WorkflowInterface $workflow
  * @param string            $execution_id
  * @return MemoryPoolInterface
  */
 protected function getMemoryPoolForWorkflow(WorkflowInterface $workflow, $execution_id)
 {
     return $workflow->getJailMemoryPool() ? JailedMemoryPool::jail($this->getMemoryPool(), ':' . $execution_id) : $this->getMemoryPool();
 }