src/Entity/Registrations.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RegistrationsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassRegistrationsRepository::class)]
  9. class Registrations
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\ManyToOne(inversedBy'registrations')]
  16.     #[ORM\JoinColumn(nullablefalse)]
  17.     private ?User $userId null;
  18.     #[ORM\ManyToOne(inversedBy'registrations')]
  19.     #[ORM\JoinColumn(nullablefalse)]
  20.     private ?Events $eventId null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $qrCode null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $manualCode null;
  25.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  26.     private ?\DateTimeInterface $created null;
  27.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  28.     private ?\DateTimeInterface $updated null;
  29.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  30.     private ?\DateTimeInterface $lastScanned null;
  31.     #[ORM\Column]
  32.     private ?bool $valid null;
  33.     #[ORM\Column(options: ['default' => true])]
  34.     private ?bool $active true;
  35.     #[ORM\Column(length10nullabletrue)]
  36.     private ?string $method null;
  37.     #[ORM\OneToMany(mappedBy'Registration'targetEntityAttendance::class)]
  38.     private Collection $attendances;
  39.     #[ORM\OneToMany(mappedBy'registration'targetEntityRegistrationQualification::class, orphanRemovaltrue)]
  40.     private Collection $registrationQualifications;
  41.     #[ORM\Column(length10)]
  42.     private ?string $dni null;
  43.     public function __construct()
  44.     {
  45.         $this->attendances = new ArrayCollection();
  46.         $this->registrationQualifications = new ArrayCollection();
  47.         $this->created = new \DateTime();
  48.         $this->updated = new \DateTime();
  49.         $this->active true;
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getUserId(): ?User
  56.     {
  57.         return $this->userId;
  58.     }
  59.     public function setUserId(?User $userId): static
  60.     {
  61.         $this->userId $userId;
  62.         return $this;
  63.     }
  64.     public function getEventId(): ?Events
  65.     {
  66.         return $this->eventId;
  67.     }
  68.     public function setEventId(?Events $eventId): static
  69.     {
  70.         $this->eventId $eventId;
  71.         return $this;
  72.     }
  73.     public function getQrCode(): ?string
  74.     {
  75.         return $this->qrCode;
  76.     }
  77.     public function setQrCode(?string $qrCode): static
  78.     {
  79.         $this->qrCode $qrCode;
  80.         return $this;
  81.     }
  82.     public function getManualCode(): ?string
  83.     {
  84.         return $this->manualCode;
  85.     }
  86.     public function setManualCode(?string $manualCode): static
  87.     {
  88.         $this->manualCode $manualCode;
  89.         return $this;
  90.     }
  91.     public function getCreated(): ?\DateTimeInterface
  92.     {
  93.         return $this->created;
  94.     }
  95.     public function setCreated(\DateTimeInterface $created): static
  96.     {
  97.         $this->created $created;
  98.         return $this;
  99.     }
  100.     public function getUpdated(): ?\DateTimeInterface
  101.     {
  102.         return $this->updated;
  103.     }
  104.     public function setUpdated(\DateTimeInterface $updated): static
  105.     {
  106.         $this->updated $updated;
  107.         return $this;
  108.     }
  109.     public function getLastScanned(): ?\DateTimeInterface
  110.     {
  111.         return $this->lastScanned;
  112.     }
  113.     public function setLastScanned(?\DateTimeInterface $lastScanned): static
  114.     {
  115.         $this->lastScanned $lastScanned;
  116.         return $this;
  117.     }
  118.     public function isValid(): ?bool
  119.     {
  120.         return $this->valid;
  121.     }
  122.     public function setValid(bool $valid): static
  123.     {
  124.         $this->valid $valid;
  125.         return $this;
  126.     }
  127.     public function isActive(): ?bool
  128.     {
  129.         return $this->active;
  130.     }
  131.     public function setActive(bool $active): static
  132.     {
  133.         $this->active $active;
  134.         return $this;
  135.     }
  136.     public function getMethod(): ?string
  137.     {
  138.         return $this->method;
  139.     }
  140.     public function setMethod(?string $method): static
  141.     {
  142.         $this->method $method;
  143.         return $this;
  144.     }
  145.     /**
  146.      * @return Collection<int, Attendance>
  147.      */
  148.     public function getAttendances(): Collection
  149.     {
  150.         return $this->attendances;
  151.     }
  152.     public function addAttendance(Attendance $attendance): static
  153.     {
  154.         if (!$this->attendances->contains($attendance)) {
  155.             $this->attendances->add($attendance);
  156.             $attendance->setRegistration($this);
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeAttendance(Attendance $attendance): static
  161.     {
  162.         if ($this->attendances->removeElement($attendance)) {
  163.             // set the owning side to null (unless already changed)
  164.             if ($attendance->getRegistration() === $this) {
  165.                 $attendance->setRegistration(null);
  166.             }
  167.         }
  168.         return $this;
  169.     }
  170.     public function getDni(): ?string
  171.     {
  172.         return $this->dni;
  173.     }
  174.     public function setDni(string $dni): static
  175.     {
  176.         $this->dni $dni;
  177.         return $this;
  178.     }
  179.     /**
  180.      * @return Collection<int, RegistrationQualification>
  181.      */
  182.     public function getRegistrationQualifications(): Collection
  183.     {
  184.         return $this->registrationQualifications;
  185.     }
  186.     public function addRegistrationQualification(RegistrationQualification $registrationQualification): static
  187.     {
  188.         if (!$this->registrationQualifications->contains($registrationQualification)) {
  189.             $this->registrationQualifications->add($registrationQualification);
  190.             $registrationQualification->setRegistration($this);
  191.         }
  192.         return $this;
  193.     }
  194.     public function removeRegistrationQualification(RegistrationQualification $registrationQualification): static
  195.     {
  196.         if ($this->registrationQualifications->removeElement($registrationQualification)) {
  197.             if ($registrationQualification->getRegistration() === $this) {
  198.                 $registrationQualification->setRegistration(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203. }