*/ class BookingEditDraftRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, BookingEditDraft::class); } /** * Finds a draft for a specific user and booking combination. * * @param User $user The user who owns the draft * @param int $bookingId The BusProNet booking ID * * @return BookingEditDraft|null The draft if found, null otherwise */ public function findByUserAndBooking(User $user, int $bookingId): ?BookingEditDraft { return $this->findOneBy([ 'user' => $user, 'bookingId' => $bookingId, ]); } /** * Deletes a draft for a specific user and booking combination. * * @param User $user The user who owns the draft * @param int $bookingId The BusProNet booking ID */ public function deleteByUserAndBooking(User $user, int $bookingId): void { $this->createQueryBuilder('d') ->delete() ->where('d.user = :user') ->andWhere('d.bookingId = :bookingId') ->setParameter('user', $user) ->setParameter('bookingId', $bookingId) ->getQuery() ->execute(); } }