diff --git a/src/Command/ConvertUploadsCommand.php b/src/Command/ConvertUploadsCommand.php deleted file mode 100644 index 17692f0..0000000 --- a/src/Command/ConvertUploadsCommand.php +++ /dev/null @@ -1,61 +0,0 @@ -entityManager - ->getRepository(Upload::class) - ->findBy([ - 'type' => [Upload::TYPE_INVOICE, Upload::TYPE_CONTRACT], - ]); - - $progressBar = new ProgressBar($output, count($uploads)); - $progressBar->start(); - - foreach ($uploads as $upload) { - /** @var Upload $upload */ - $filepath = $this->uploadHandler->getUploadFilepath($upload); - try { - $targetFilepath = $this->sanitizer->sanitizeFile($filepath); - $upload - ->setFilename(basename($targetFilepath)) - ->setMimeType('application/pdf') - ; - } catch (\Throwable $e) { - $output->writeln(''.$e->getMessage().''); - } - - $progressBar->advance(); - } - - $this->entityManager->flush(); - $progressBar->finish(); - - return Command::SUCCESS; - } -} diff --git a/src/Command/MailTestCommand.php b/src/Command/MailTestCommand.php deleted file mode 100644 index 63bd2e4..0000000 --- a/src/Command/MailTestCommand.php +++ /dev/null @@ -1,43 +0,0 @@ -addArgument('to', InputArgument::REQUIRED, 'Recipient email') - ->addArgument('from', InputArgument::OPTIONAL, 'Sender email', 'team@ep-reisen.de') - ; - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $email = (new Email()) - ->to($input->getArgument('to')) - ->from($input->getArgument('from')) - ->subject('Testing SMTP Transport') - ->text('Testing SMTP Transport'); - - $this->mailer->send($email); - - return Command::SUCCESS; - } -} diff --git a/src/Command/UpdateDestinationCostUnitsCommand.php b/src/Command/UpdateDestinationCostUnitsCommand.php deleted file mode 100644 index 18f3412..0000000 --- a/src/Command/UpdateDestinationCostUnitsCommand.php +++ /dev/null @@ -1,134 +0,0 @@ -addOption( - 'dry-run', - null, - InputOption::VALUE_NONE, - 'Run without persisting changes to the database' - ); - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $io = new SymfonyStyle($input, $output); - $isDryRun = true === $input->getOption('dry-run'); - - if ($isDryRun) { - $io->note('Running in dry-run mode. No changes will be persisted.'); - } - - $qb = $this->destinationRepository->createQueryBuilder('d'); - $destinations = $qb - ->where($qb->expr()->isNotNull('d.hotelBusProId')) - ->andWhere($qb->expr()->orX( - $qb->expr()->isNull('d.costUnit'), - $qb->expr()->eq('d.costUnit', ':emptyString') - )) - ->andWhere($qb->expr()->isNull('d.deletedAt')) - ->setParameter('emptyString', '') - ->getQuery() - ->getResult() - ; - - $totalCount = count($destinations); - - if (0 === $totalCount) { - $io->success('No destinations found that need cost unit updates.'); - - return Command::SUCCESS; - } - - $io->info(sprintf('Found %d destination(s) with assigned hotels and empty cost units.', $totalCount)); - - $updatedCount = 0; - $skippedCount = 0; - - foreach ($destinations as $destination) { - $hotelBusProId = $destination->getHotelBusProId(); - $hotel = $this->hotelDataProvider->get($hotelBusProId); - - if (null === $hotel) { - $io->warning(sprintf( - 'Hotel with BusProId %d not found for destination #%d', - $hotelBusProId, - $destination->getId() - )); - ++$skippedCount; - continue; - } - - $costUnit = $hotel->getCostUnit(); - - if (null === $costUnit || '' === $costUnit) { - $io->warning(sprintf( - 'Hotel "%s" (BusProId: %d) has no cost unit. Skipping destination #%d', - $hotel->getName(), - $hotelBusProId, - $destination->getId() - )); - ++$skippedCount; - continue; - } - - $destination->setCostUnit($costUnit); - ++$updatedCount; - - $io->writeln(sprintf( - 'Updated destination #%d (%s) with cost unit "%s" from hotel "%s"', - $destination->getId(), - $destination->getProduct(), - $costUnit, - $hotel->getName() - )); - } - - if (false === $isDryRun && $updatedCount > 0) { - $this->entityManager->flush(); - $io->success(sprintf( - 'Successfully updated %d destination(s). Skipped %d destination(s).', - $updatedCount, - $skippedCount - )); - } elseif ($isDryRun && $updatedCount > 0) { - $io->success(sprintf( - 'Dry-run complete. Would update %d destination(s). Would skip %d destination(s).', - $updatedCount, - $skippedCount - )); - } else { - $io->info(sprintf('No destinations updated. Skipped %d destination(s).', $skippedCount)); - } - - return Command::SUCCESS; - } -}