Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
716cf56cb2.url-de-test.ws
/
htdocs
/
src
/
Command
/
/srv/data/web/vhosts/716cf56cb2.url-de-test.ws/htdocs/src/Command/PayRest.php
<?php namespace App\Command; use App\Repository\BookingRepository; use App\Service\Mailer; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class PayRest extends Command { protected static $defaultName = 'PayRest'; protected static $defaultDescription = 'Add a short description for your command'; private $bookingRepository; private $mailer; public function __construct(BookingRepository $bookingRepository, Mailer $mailer) { parent::__construct(); $this->bookingRepository = $bookingRepository; $this->mailer = $mailer; } protected function execute(InputInterface $input, OutputInterface $output): int { $currentDate = new \DateTime(); $date = $currentDate->modify('+30 days'); $bookings = $this->bookingRepository->findBookingsPayRest($date); foreach ($bookings as $booking) { try { $this->mailer->payRest($booking); $booking->setTokenRest(null); } catch (\Exception $e) { $output->writeln("erreur envoi d'email: " . $e->getMessage()); } } $output->writeln('send email to pay rest ' . $currentDate->format('d-m-Y h:i')); return Command::SUCCESS; } }