feat: cli command to clean up outdated or stale booking draft records
This commit is contained in:
@@ -10,6 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
#[ORM\Entity(repositoryClass: BookingEditDraftRepository::class)]
|
||||
#[ORM\Table(name: 'booking_edit_draft')]
|
||||
#[ORM\UniqueConstraint(name: 'user_booking_unique', columns: ['user_id', 'booking_id'])]
|
||||
#[ORM\Index(name: 'IDX_DRAFT_TRAVEL_DATE', columns: ['travel_date'])]
|
||||
class BookingEditDraft
|
||||
{
|
||||
#[ORM\Id]
|
||||
@@ -24,6 +25,9 @@ class BookingEditDraft
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private int $bookingId;
|
||||
|
||||
#[ORM\Column(type: 'date_immutable')]
|
||||
private \DateTimeImmutable $travelDate;
|
||||
|
||||
#[ORM\Column(type: 'json')]
|
||||
private array $formData = [];
|
||||
|
||||
@@ -33,10 +37,11 @@ class BookingEditDraft
|
||||
#[ORM\Column(type: 'datetime_immutable')]
|
||||
private \DateTimeImmutable $updatedAt;
|
||||
|
||||
public function __construct(User $user, int $bookingId, array $formData)
|
||||
public function __construct(User $user, int $bookingId, \DateTimeImmutable $travelDate, array $formData)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->bookingId = $bookingId;
|
||||
$this->travelDate = $travelDate;
|
||||
$this->formData = $formData;
|
||||
$this->createdAt = new \DateTimeImmutable();
|
||||
$this->updatedAt = new \DateTimeImmutable();
|
||||
@@ -57,6 +62,11 @@ class BookingEditDraft
|
||||
return $this->bookingId;
|
||||
}
|
||||
|
||||
public function getTravelDate(): \DateTimeImmutable
|
||||
{
|
||||
return $this->travelDate;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return $this->formData;
|
||||
|
||||
Reference in New Issue
Block a user