EducationTeacher.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. namespace AppBundle\Entity\Education;
  3. use AppBundle\Entity\AccessAndFunction\Access;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Dunglas\ApiBundle\Annotation\Iri;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. use AppBundle\Entity\Traits\TimestampableEntity;
  10. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  11. /**
  12. * Fait le lien entre un Access (professeur) et un Education (enseignement)
  13. *
  14. * @Iri("http://schema.org/educationteacher")
  15. */
  16. #[ORM\Entity]
  17. class EducationTeacher
  18. {
  19. use TimestampableEntity;
  20. use CreatorUpdaterEntity;
  21. /**
  22. * @var int
  23. */
  24. #[ORM\Column(type: 'integer')]
  25. #[ORM\Id]
  26. #[ORM\GeneratedValue(strategy: 'AUTO')]
  27. #[Groups(['educationteacher'])]
  28. private $id;
  29. /**
  30. * @var string
  31. */
  32. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Education\Education', inversedBy: 'educationTeachers')]
  33. #[ORM\JoinColumn(onDelete: 'CASCADE')]
  34. #[Assert\NotNull]
  35. #[Groups(['educationteacher'])]
  36. private $education;
  37. /**
  38. * @var Access
  39. */
  40. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'educationTeachers')]
  41. #[Assert\NotNull]
  42. #[Groups(['educationteacher', 'educationteacher_reference'])]
  43. private $teacher;
  44. /**
  45. * @var ArrayCollection<SeizurePeriodNotation>
  46. */
  47. #[Assert\Valid]
  48. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\SeizurePeriodNotation', mappedBy: 'educationTeacher', orphanRemoval: true, cascade: ['persist', 'remove'])]
  49. #[Groups(['educationstudent_seizureperiodnotation'])]
  50. private $seizurePeriodNotations;
  51. /**
  52. * Constructor
  53. */
  54. public function __construct()
  55. {
  56. $this->seizurePeriodNotations = new ArrayCollection();
  57. }
  58. /**
  59. * Sets id.
  60. *
  61. * @param int $id
  62. *
  63. * @return $this
  64. */
  65. public function setId($id)
  66. {
  67. $this->id = $id;
  68. return $this;
  69. }
  70. /**
  71. * Gets id.
  72. *
  73. * @return int
  74. */
  75. public function getId()
  76. {
  77. return $this->id;
  78. }
  79. /**
  80. * Set education
  81. *
  82. * @param \AppBundle\Entity\Education\Education $education
  83. *
  84. * @return EducationTeacher
  85. */
  86. public function setEducation(\AppBundle\Entity\Education\Education $education = null)
  87. {
  88. $this->education = $education;
  89. return $this;
  90. }
  91. /**
  92. * Get education
  93. *
  94. * @return \AppBundle\Entity\Education\Education
  95. */
  96. public function getEducation()
  97. {
  98. return $this->education;
  99. }
  100. /**
  101. * Set teacher
  102. *
  103. * @param \AppBundle\Entity\AccessAndFunction\Access $teacher
  104. *
  105. * @return EducationTeacher
  106. */
  107. public function setTeacher(\AppBundle\Entity\AccessAndFunction\Access $teacher = null)
  108. {
  109. $this->teacher = $teacher;
  110. return $this;
  111. }
  112. /**
  113. * Get teacher
  114. *
  115. * @return \AppBundle\Entity\AccessAndFunction\Access
  116. */
  117. public function getTeacher()
  118. {
  119. return $this->teacher;
  120. }
  121. /**
  122. * Add seizurePeriodNotation
  123. *
  124. * @param \AppBundle\Entity\Education\SeizurePeriodNotation $seizurePeriodNotation
  125. *
  126. * @return EducationTeacher
  127. */
  128. public function addSeizurePeriodNotation(\AppBundle\Entity\Education\SeizurePeriodNotation $seizurePeriodNotation)
  129. {
  130. $seizurePeriodNotation->setEducationTeacher($this);
  131. $this->seizurePeriodNotations[] = $seizurePeriodNotation;
  132. return $this;
  133. }
  134. /**
  135. * Remove seizurePeriodNotation
  136. *
  137. * @param \AppBundle\Entity\Education\SeizurePeriodNotation $seizurePeriodNotation
  138. */
  139. public function removeSeizurePeriodNotation(\AppBundle\Entity\Education\SeizurePeriodNotation $seizurePeriodNotation)
  140. {
  141. $this->seizurePeriodNotations->removeElement($seizurePeriodNotation);
  142. }
  143. /**
  144. * Get seizurePeriodNotations
  145. *
  146. * @return \Doctrine\Common\Collections\Collection
  147. */
  148. public function getSeizurePeriodNotations()
  149. {
  150. return $this->seizurePeriodNotations;
  151. }
  152. }