src/Entity/QrCode.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\QrCodeRepository;
  4. use App\Trait\DateTrait;
  5. use DateTimeImmutable;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassQrCodeRepository::class)]
  8. class QrCode
  9. {
  10.     use DateTrait;
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $name null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $code null;
  19.     #[ORM\ManyToOne(inversedBy'qrCodes')]
  20.     #[ORM\JoinColumn(nullablefalse)]
  21.     private ?Establishment $establishment null;
  22.     public function __construct()
  23.     {
  24.         if (is_null($this->createdAt)) $this->createdAt = new DateTimeImmutable();
  25.         $this->updatedAt = new DateTimeImmutable();
  26.     }
  27.     public function getId(): ?int
  28.     {
  29.         return $this->id;
  30.     }
  31.     public function getName(): ?string
  32.     {
  33.         return $this->name;
  34.     }
  35.     public function setName(string $name): static
  36.     {
  37.         $this->name $name;
  38.         return $this;
  39.     }
  40.     public function getCode(): ?string
  41.     {
  42.         return $this->code;
  43.     }
  44.     public function setCode(string $code): static
  45.     {
  46.         $this->code $code;
  47.         return $this;
  48.     }
  49.     public function getEstablishment(): ?Establishment
  50.     {
  51.         return $this->establishment;
  52.     }
  53.     public function setEstablishment(?Establishment $establishment): static
  54.     {
  55.         $this->establishment $establishment;
  56.         return $this;
  57.     }
  58.     public function __toString(): string
  59.     {
  60.         return $this->name;
  61.     }
  62. }