setName('sharing:delete-share') ->setDescription('Delete a share.') ->addArgument('id', InputArgument::REQUIRED, 'Share ID'); } #[\Override] public function execute(InputInterface $input, OutputInterface $output): int { /** @var string $id */ $id = $input->getArgument('id'); try { try { $this->dbConnection->beginTransaction(); $share = $this->manager->getShare($this->accessContext, $id); $this->manager->deleteShare($this->accessContext, $share); $this->dbConnection->commit(); return Base::SUCCESS; } catch (Exception $exception) { $this->dbConnection->rollBack(); throw $exception; } } catch (AShareException $aShareException) { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); } $output->writeln($aShareException->getMessage()); return Base::FAILURE; } } }