storage = $storage; $this->templateStorage = $templateStorage; } public function createWorkflow(string $slug): Workflow { $template = $this->templateStorage->getTemplateBySlug($slug); if (! $template) { throw UnexpectedValueException::create()->withMessage('Template not found.'); } $this->storage->createWorkflow($template->getWorkflow()); return $template->getWorkflow(); } }