<?php
namespace App\Entity;
use App\Repository\TicketGratterRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TicketGratterRepository::class)]
class TicketGratter
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'ticketGratters')]
#[ORM\JoinColumn(nullable: false)]
private ?User $user = null;
#[ORM\ManyToOne(inversedBy: 'ticketGratters')]
private ?Offre $offre = null;
#[ORM\Column]
private ?bool $isWinning = null;
#[ORM\Column]
private ?bool $isScratched = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $scratchedAt = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $slug = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $qrCodePath = null;
#[ORM\Column]
private ?bool $active = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dateUsed = null;
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): static
{
$this->user = $user;
return $this;
}
public function getOffre(): ?Offre
{
return $this->offre;
}
public function setOffre(?Offre $offre): static
{
$this->offre = $offre;
return $this;
}
public function isIsWinning(): ?bool
{
return $this->isWinning;
}
public function setIsWinning(bool $isWinning): static
{
$this->isWinning = $isWinning;
return $this;
}
public function isIsScratched(): ?bool
{
return $this->isScratched;
}
public function setIsScratched(bool $isScratched): static
{
$this->isScratched = $isScratched;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function getScratchedAt(): ?\DateTimeInterface
{
return $this->scratchedAt;
}
public function setScratchedAt(?\DateTimeInterface $scratchedAt): static
{
$this->scratchedAt = $scratchedAt;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): static
{
$this->slug = $slug;
return $this;
}
public function getQrCodePath(): ?string
{
return $this->qrCodePath;
}
public function setQrCodePath(?string $qrCodePath): static
{
$this->qrCodePath = $qrCodePath;
return $this;
}
public function getExpirationDate(): \DateTime
{
$expirationDate = clone $this->scratchedAt;
return $expirationDate->modify('+2 month');
}
public function getTypeEntity(): string
{
return 'ticket';
}
public function isActive(): ?bool
{
return $this->active;
}
public function setActive(bool $active): static
{
$this->active = $active;
return $this;
}
public function getDateUsed(): ?\DateTimeInterface
{
return $this->dateUsed;
}
public function setDateUsed(?\DateTimeInterface $dateUsed): static
{
$this->dateUsed = $dateUsed;
return $this;
}
}