refs #2181. Changed Output messages
parent
ca4cdafc01
commit
119c24f4e5
|
@ -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);
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filter;
|
||||
|
||||
use ApiPlatform\Doctrine\Orm\Filter\AbstractFilter;
|
||||
use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface;
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use Symfony\Component\PropertyInfo\Type;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
||||
class SoftwareProfileSearchSoftwareFilter extends AbstractFilter
|
||||
{
|
||||
protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void
|
||||
{
|
||||
if ($property !== 'softwareProfileId') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (null === $value || '' === $value || 'undefined' === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$alias = $queryBuilder->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.',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue