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);