/** * Run the tasks success decider, allowing the task a chance to schedule some events * * @param WorkflowHistoryItem $history_item * @param Decision $decision * @param MemoryPoolInterface $memory_pool */ protected function runTaskDecider(WorkflowHistoryItem $history_item, Decision $decision, MemoryPoolInterface $memory_pool) { foreach ($this->getWorkflow()->getTasks() as $task) { if ($history_item->getActivityName() == $task->getActivityName() && $history_item->getActivityVersion() == $task->getActivityVersion()) { $class = $task->getClass(); /** @var TaskInterface $obj */ $obj = new $class($memory_pool, $history_item->getInput(), $this->getAuxPayload()); if (!$obj instanceof TaskInterface) { throw new \DomainException("Class for task " . $task->getActivityName() . " is not a TaskInterface"); } $obj->onSuccess($this->getWorkflow(), $history_item, $decision); } } }