From 119c24f4e5e470f89b218e273439dc7943621f50 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 9 Jun 2025 11:51:43 +0200 Subject: [PATCH] refs #2181. Changed Output messages --- .../OgBoot/OgLive/InstallAction.php | 2 +- .../SoftwareProfileSearchSoftwareFilter.php | 43 +++++++++++++++++++ src/State/Processor/OgLiveProcessor.php | 16 ++++--- 3 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 src/Filter/SoftwareProfileSearchSoftwareFilter.php diff --git a/src/Controller/OgBoot/OgLive/InstallAction.php b/src/Controller/OgBoot/OgLive/InstallAction.php index 5538bf9..5d09625 100644 --- a/src/Controller/OgBoot/OgLive/InstallAction.php +++ b/src/Controller/OgBoot/OgLive/InstallAction.php @@ -54,7 +54,7 @@ class InstallAction extends AbstractOgBootController $this->createService->__invoke(null, CommandTypes::INSTALL_OGLIVE, TraceStatus::IN_PROGRESS, 'InstallOgLive_'.$data->getUuid(), $inputData); - $data->setName($this->simplifyOgLiveFilenameService->__invoke($data->getFilename())); + $data->setName($this->simplifyOgLiveFilenameService->__invoke($data->getFilename()) ?? 'OgLive_'.$data->getUuid()); $data->setDate(new \DateTime()); $data->setStatus(OgLiveStatus::PENDING); $this->entityManager->persist($data); diff --git a/src/Filter/SoftwareProfileSearchSoftwareFilter.php b/src/Filter/SoftwareProfileSearchSoftwareFilter.php new file mode 100644 index 0000000..b5ce850 --- /dev/null +++ b/src/Filter/SoftwareProfileSearchSoftwareFilter.php @@ -0,0 +1,43 @@ +getRootAliases()[0]; + $joinAlias = $queryNameGenerator->generateJoinAlias('softwareProfileId'); + + $queryBuilder + ->innerJoin(sprintf('%s.softwareProfiles', $alias), $joinAlias) + ->andWhere(sprintf('%s.id = :softwareProfileId', $joinAlias)) + ->setParameter('softwareProfileId', $value); + } + + public function getDescription(string $resourceClass): array + { + return [ + 'softwareProfileId' => [ + 'property' => 'softwareProfileId', + 'type' => Type::BUILTIN_TYPE_INT, + 'required' => false, + 'description' => 'Filter software profiles by ID.', + ], + ]; + } +} diff --git a/src/State/Processor/OgLiveProcessor.php b/src/State/Processor/OgLiveProcessor.php index edef074..c2b692e 100644 --- a/src/State/Processor/OgLiveProcessor.php +++ b/src/State/Processor/OgLiveProcessor.php @@ -15,6 +15,7 @@ use App\Dto\Input\OgLiveInput; use App\Dto\Output\OgLiveOutput; use App\Model\OgLiveStatus; use App\Repository\OgLiveRepository; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; @@ -26,7 +27,8 @@ readonly class OgLiveProcessor implements ProcessorInterface private OgLiveRepository $ogLiveRepository, private ValidatorInterface $validator, private InstallAction $installAction, - private UninstallAction $uninstallAction + private UninstallAction $uninstallAction, + private KernelInterface $kernel, ) { } @@ -65,8 +67,10 @@ readonly class OgLiveProcessor implements ProcessorInterface $this->validator->validate($ogLive); $this->ogLiveRepository->save($ogLive); - if ($operation instanceof Post) { - $this->installAction->__invoke($ogLive); + if ($this->kernel->getEnvironment() !== 'test') { + if ($operation instanceof Post) { + $this->installAction->__invoke($ogLive); + } } return new OgLiveOutput($ogLive); @@ -82,8 +86,10 @@ readonly class OgLiveProcessor implements ProcessorInterface { $ogLive = $this->ogLiveRepository->findOneByUuid($uriVariables['uuid']); - if ($ogLive->getStatus() === OgLiveStatus::ACTIVE) { - $this->uninstallAction->__invoke($ogLive); + if ($this->kernel->getEnvironment() !== 'test') { + if ($ogLive->getStatus() === OgLiveStatus::ACTIVE) { + $this->uninstallAction->__invoke($ogLive); + } } $this->ogLiveRepository->delete($ogLive);