From 79e199f547d2fdc39b322f62538912a066fe86f8 Mon Sep 17 00:00:00 2001 From: Mathieu De Keyzer Date: Thu, 1 Feb 2024 17:36:49 +0100 Subject: [PATCH] ref: better --- EMS/core-bundle/src/Command/Revision/DeleteCommand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EMS/core-bundle/src/Command/Revision/DeleteCommand.php b/EMS/core-bundle/src/Command/Revision/DeleteCommand.php index 3299499c2..259ba0e7b 100644 --- a/EMS/core-bundle/src/Command/Revision/DeleteCommand.php +++ b/EMS/core-bundle/src/Command/Revision/DeleteCommand.php @@ -82,6 +82,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (null !== $ouuid) { throw new \RuntimeException(\sprintf('The %s option is forbidden in %s mode', self::OPTION_OUUID, $this->mode)); } + if (null === $queryJson) { + throw new \RuntimeException(\sprintf('The %s option is required in %s mode', self::OPTION_QUERY, $this->mode)); + } return $this->deleteByQuery($queryJson); } @@ -115,11 +118,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int return parent::EXECUTE_SUCCESS; } - private function deleteByQuery(?string $queryJson): int + private function deleteByQuery(string $queryJson): int { - if (null === $queryJson) { - throw new \RuntimeException(\sprintf('The %s option is required in %s mode', self::OPTION_QUERY, $this->mode)); - } $search = $this->elasticaService->convertElasticsearchSearch(Json::decode($queryJson)); $this->io->progressStart($this->elasticaService->count($search)); $scroll = $this->elasticaService->scroll($search);