src/Entity/Ticket.php line 23
<?phpdeclare(strict_types=1);namespace App\Entity;use ApiPlatform\Metadata\ApiResource;use ApiPlatform\Metadata\Get;use ApiPlatform\Metadata\GetCollection;use ApiPlatform\Metadata\Post;use App\Controller\Api\Ticket\ApiTicketCheckController;use App\Controller\Api\Ticket\ApiTicketSellController;use App\Repository\TicketRepository;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;#[ApiResource(operations: [new GetCollection()])]#[ORM\Entity(repositoryClass: TicketRepository::class)]class Ticket{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]#[Groups(['ticket:new'])]private ?int $id = null;#[ORM\Column]private ?int $number = null;#[ORM\ManyToOne(inversedBy: 'tickets')]#[ORM\JoinColumn(nullable: false)]private ?Lot $lot = null;#[ORM\Column(options: ['default' => false])]private ?bool $isScanned = false;#[ORM\Column(options: ['default' => false])]private ?bool $isSell = false;#[ORM\Column(nullable: true)]private ?\DateTimeImmutable $scannedAt = null;#[ORM\Column(nullable: true)]private ?\DateTimeImmutable $sellAt = null;#[ORM\Column]private ?int $checkNbr = 0;#[ORM\Column(length: 255, nullable: true)]#[Groups(['ticket:new'])]private ?string $serial;#[ORM\ManyToOne]private ?Employee $sellBy = null;#[ORM\ManyToOne]private ?Employee $checkedBy = null;public function getId(): ?int{return $this->id;}public function getNumber(): ?int{return $this->number;}public function setNumber(int $number): self{$this->number = $number;return $this;}public function getLot(): ?Lot{return $this->lot;}public function setLot(?Lot $lot): self{$this->lot = $lot;return $this;}public function isIsScanned(): bool{return $this->isScanned;}public function setIsScanned(bool $isScanned): self{$this->isScanned = $isScanned;return $this;}public function isIsSell(): bool{return $this->isSell;}public function setIsSell(bool $isSell): self{$this->isSell = $isSell;return $this;}public function getScannedAt(): ?\DateTimeImmutable{return $this->scannedAt;}public function setScannedAt(?\DateTimeImmutable $scannedAt): self{$this->scannedAt = $scannedAt;return $this;}public function getSellAt(): ?\DateTimeImmutable{return $this->sellAt;}public function setSellAt(?\DateTimeImmutable $sellAt): self{$this->sellAt = $sellAt;return $this;}public function getCheckNbr(): ?int{return $this->checkNbr;}public function check(){return $this->checkNbr++;}public function setCheckNbr(int $checkNbr): self{$this->checkNbr = $checkNbr;return $this;}public function getSerial(): ?string{return $this->serial;}public function setSerial(?string $serial): self{$this->serial = $serial;return $this;}public function getSellBy(): ?Employee{return $this->sellBy;}public function setSellBy(?Employee $sellBy): self{$this->sellBy = $sellBy;return $this;}public function getCheckedBy(): ?Employee{return $this->checkedBy;}public function setCheckedBy(?Employee $checkedBy): self{$this->checkedBy = $checkedBy;return $this;}public function getSerialId(): string{return "{$this->getSerial()}-{$this->getId()}";}public function __toString(): string{return "$this->number pour {$this->getLot()->getConfiguration()->getName()}";}}