category !== null) { $category = AppreciationCategory::tryFrom($command->category); if ($category === null) { throw CategorieAppreciationInvalideException::pourValeur($command->category); } } $template = AppreciationTemplate::creer( tenantId: TenantId::fromString($command->tenantId), teacherId: UserId::fromString($command->teacherId), title: $command->title, content: $command->content, category: $category, now: $this->clock->now(), ); $this->templateRepository->save($template); return $template; } }