src/Entity/Lot.php line 15
<?phpnamespace App\Entity;use App\Repository\LotRepository;use App\Trait\ActivableTrait;use App\Trait\DateTrait;use DateTime;use DateTimeImmutable;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: LotRepository::class)]class Lot{use ActivableTrait;use DateTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $reference = null;#[ORM\Column]private ?int $start = null;#[ORM\Column]private ?int $end = null;#[ORM\Column(length: 255)]private ?string $series = null;#[ORM\OneToMany(mappedBy: 'lot', targetEntity: Ticket::class, cascade: ['persist', 'remove'])]private Collection $tickets;#[ORM\ManyToOne]#[ORM\JoinColumn(nullable: false)]private ?Establishment $establishment = null;#[ORM\ManyToOne(inversedBy: 'lots')]private ?Department $department = null;#[ORM\ManyToOne(inversedBy: 'lots')]#[ORM\JoinColumn(nullable: false)]private ?LotConfiguration $configuration = null;#[ORM\OneToMany(mappedBy: 'lot', targetEntity: Card::class)]private Collection $cards;public function __construct(){$this->isActive = true;if (is_null($this->reference)) $this->reference = strtoupper(uniqid('LOT-'));if (is_null($this->createdAt)) $this->createdAt = new DateTimeImmutable();$this->updatedAt = new DateTimeImmutable();$this->tickets = new ArrayCollection();$this->cards = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getReference(): ?string{return $this->reference;}public function setReference(string $reference): self{$this->reference = $reference;return $this;}public function getStart(): ?int{return $this->start;}public function setStart(int $start): self{$this->start = $start;return $this;}public function getEnd(): ?int{return $this->end;}public function setEnd(int $end): self{$this->end = $end;return $this;}public function getSeries(): ?string{return $this->series;}public function setSeries(string $series): self{$this->series = $series;return $this;}/*** @return Collection<int, Ticket>*/public function getTickets(): Collection{return $this->tickets;}public function addTicket(Ticket $ticket): self{if (!$this->tickets->contains($ticket)) {$this->tickets->add($ticket);$ticket->setLot($this);}return $this;}public function removeTicket(Ticket $ticket): self{if ($this->tickets->removeElement($ticket)) {// set the owning side to null (unless already changed)if ($ticket->getLot() === $this) {$ticket->setLot(null);}}return $this;}public function getEstablishment(): ?Establishment{return $this->establishment;}public function setEstablishment(?Establishment $establishment): self{$this->establishment = $establishment;return $this;}public function getDepartment(): ?Department{return $this->department;}public function setDepartment(?Department $department): self{$this->department = $department;return $this;}public function getConfiguration(): ?LotConfiguration{return $this->configuration;}public function setConfiguration(?LotConfiguration $configuration): self{$this->configuration = $configuration;return $this;}/*** @return Collection<int, Card>*/public function getCards(): Collection{return $this->cards;}public function addCard(Card $card): static{if (!$this->cards->contains($card)) {$this->cards->add($card);$card->setLot($this);}return $this;}public function removeCard(Card $card): static{if ($this->cards->removeElement($card)) {// set the owning side to null (unless already changed)if ($card->getLot() === $this) {$card->setLot(null);}}return $this;}}