ExamenConvocation.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Booking;
  4. use App\Entity\Access\Access;
  5. use App\Entity\Product\Equipment;
  6. use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * Classe ... qui ...
  12. */
  13. #[Auditable]
  14. #[ORM\Entity]
  15. class ExamenConvocation
  16. {
  17. #[ORM\Id]
  18. #[ORM\Column]
  19. #[ORM\GeneratedValue]
  20. private ?int $id = null;
  21. #[ORM\ManyToOne(inversedBy: 'convocation')]
  22. private Examen $examen;
  23. #[ORM\ManyToOne(inversedBy: 'examenConvocations')]
  24. #[ORM\JoinColumn(nullable: false)]
  25. private Access $student;
  26. #[ORM\ManyToMany(targetEntity: Equipment::class)]
  27. #[ORM\JoinColumn(name: 'examenconvocation_id', referencedColumnName: 'id')]
  28. #[ORM\InverseJoinColumn(name: 'equipment_id', referencedColumnName: 'id')]
  29. private Collection $equipments;
  30. public function __construct()
  31. {
  32. $this->equipments = new ArrayCollection();
  33. }
  34. public function getId(): ?int
  35. {
  36. return $this->id;
  37. }
  38. public function getExamen(): ?Examen
  39. {
  40. return $this->examen;
  41. }
  42. public function setExamen(?Examen $examen): self
  43. {
  44. $this->examen = $examen;
  45. return $this;
  46. }
  47. public function getStudent(): ?Access
  48. {
  49. return $this->student;
  50. }
  51. public function setStudent(?Access $student): self
  52. {
  53. $this->student = $student;
  54. return $this;
  55. }
  56. /**
  57. * @return Collection<int, Equipment>
  58. */
  59. public function getEquipments(): Collection
  60. {
  61. return $this->equipments;
  62. }
  63. public function addEquipment(Equipment $equipment): self
  64. {
  65. if (!$this->equipments->contains($equipment)) {
  66. $this->equipments[] = $equipment;
  67. }
  68. return $this;
  69. }
  70. public function removeEquipment(Equipment $equipment): self
  71. {
  72. $this->equipments->removeElement($equipment);
  73. return $this;
  74. }
  75. }