EducationTeacher.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. declare (strict_types=1);
  3. namespace App\Entity\Education;
  4. use ApiPlatform\Metadata\Get;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use App\Entity\Access\Access;
  7. //use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. /**
  12. * Classe ... qui ...
  13. */
  14. #[ApiResource(operations: [])]
  15. //#[Auditable]
  16. #[ORM\Entity]
  17. class EducationTeacher
  18. {
  19. #[ORM\Id]
  20. #[ORM\Column]
  21. #[ORM\GeneratedValue]
  22. private ?int $id = null;
  23. #[ORM\ManyToOne(inversedBy: 'educationTeachers')]
  24. #[ORM\JoinColumn(onDelete: 'CASCADE')]
  25. private Education $education;
  26. #[ORM\ManyToOne(inversedBy: 'educationTeachers')]
  27. private Access $teacher;
  28. #[ORM\OneToMany(mappedBy: 'educationTeacher', targetEntity: SeizurePeriodNotation::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
  29. private Collection $seizurePeriodNotations;
  30. public function __construct()
  31. {
  32. $this->seizurePeriodNotations = new ArrayCollection();
  33. }
  34. public function getId(): ?int
  35. {
  36. return $this->id;
  37. }
  38. public function getEducation(): ?Education
  39. {
  40. return $this->education;
  41. }
  42. public function setEducation(?Education $education): self
  43. {
  44. $this->education = $education;
  45. return $this;
  46. }
  47. public function getTeacher(): ?Access
  48. {
  49. return $this->teacher;
  50. }
  51. public function setTeacher(?Access $teacher): self
  52. {
  53. $this->teacher = $teacher;
  54. return $this;
  55. }
  56. /**
  57. * @return Collection<int, SeizurePeriodNotation>
  58. */
  59. public function getSeizurePeriodNotations(): Collection
  60. {
  61. return $this->seizurePeriodNotations;
  62. }
  63. public function addSeizurePeriodNotation(SeizurePeriodNotation $seizurePeriodNotation): self
  64. {
  65. if (!$this->seizurePeriodNotations->contains($seizurePeriodNotation)) {
  66. $this->seizurePeriodNotations[] = $seizurePeriodNotation;
  67. $seizurePeriodNotation->setEducationTeacher($this);
  68. }
  69. return $this;
  70. }
  71. public function removeSeizurePeriodNotation(SeizurePeriodNotation $seizurePeriodNotation): self
  72. {
  73. if ($this->seizurePeriodNotations->removeElement($seizurePeriodNotation)) {
  74. // set the owning side to null (unless already changed)
  75. if ($seizurePeriodNotation->getEducationTeacher() === $this) {
  76. $seizurePeriodNotation->setEducationTeacher(null);
  77. }
  78. }
  79. return $this;
  80. }
  81. }