feat(appointment): auto-expire unpaid bookings via Symfony Scheduler

Run the 15-min payment-expiry every minute through Symfony Scheduler so
unpaid pending bookings flip to expired without a system crontab. Install
symfony/scheduler; extract the expiry logic into AppointmentExpiryService
(reused by the existing command); add ExpireAppointmentsMessage + handler
and an #[AsSchedule] provider (RecurringMessage::every 1 minute); wire a
scheduler_default transport in messenger.yaml. Slots already free
just-in-time via isSlotTaken, so this only syncs the DB status.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-15 22:43:50 +03:30
co-authored by Claude Opus 4.8
parent a348dcae5f
commit 71ab8892c9
12 changed files with 400 additions and 23 deletions
@@ -0,0 +1,18 @@
<?php
namespace App\Appointment\MessageHandler;
use App\Appointment\Message\ExpireAppointmentsMessage;
use App\Appointment\Service\AppointmentExpiryService;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
#[AsMessageHandler]
final class ExpireAppointmentsHandler
{
public function __construct(private readonly AppointmentExpiryService $expiryService) {}
public function __invoke(ExpireAppointmentsMessage $message): void
{
$this->expiryService->expireStale();
}
}