feat: cli command to clean up outdated or stale booking draft records

This commit is contained in:
Björn Fromme
2026-03-16 12:02:27 +01:00
parent e09e5858d8
commit 1fa17a7df7
6 changed files with 142 additions and 3 deletions
@@ -52,4 +52,19 @@ class BookingEditDraftRepository extends ServiceEntityRepository
->getQuery()
->execute();
}
/**
* Deletes all drafts where the travel date has passed.
*
* @return int Number of deleted drafts
*/
public function deleteExpiredDrafts(): int
{
return (int) $this->createQueryBuilder('d')
->delete()
->where('d.travelDate < :today')
->setParameter('today', new \DateTimeImmutable('today'))
->getQuery()
->execute();
}
}