environmentRepository->find($id) : null; if (null === $environment) { throw new NotFoundHttpException(sprintf('Environment "%s" not found.', $id)); } $requestData = $context['request']?->toArray() ?? []; $tag = $requestData['tag'] ?? null; if (null === $tag || '' === $tag) { throw new BadRequestHttpException('The "tag" field is required.'); } $result = $this->deployService->deploy($environment, $tag); $dto = new DeployResult(); $dto->success = $result['success']; $dto->output = $result['output']; $dto->tag = $tag; return $dto; } }