src/Core/Entity/Institucion/Seccion.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Core\Entity\Institucion;
  3. use App\Core\Entity\EstudianteCurso;
  4. use App\Core\Repository\Institucion\SeccionRepository;
  5. use App\Core\Entity\MaestroCurso;
  6. use App\Core\Entity\Curso;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * @ORM\Entity(repositoryClass=SeccionRepository::class)
  12. */
  13. class Seccion
  14. {
  15. const JSON_FIELDS = ['id', 'nombre', 'correlativo', 'nivel' => ['id', 'nombre'], 'seccionClon' => ['id', 'nombre']];
  16. /**
  17. * @ORM\Id
  18. * @ORM\GeneratedValue
  19. * @ORM\Column(type="integer")
  20. */
  21. private $id;
  22. /**
  23. * @ORM\Column(type="string", length=100)
  24. */
  25. private $nombre;
  26. /**
  27. * @ORM\Column(type="string", length=50, nullable=true)
  28. */
  29. private $correlativo;
  30. /**
  31. * @ORM\ManyToOne(targetEntity=Nivel::class, inversedBy="secciones")
  32. */
  33. private $nivel;
  34. /**
  35. * @ORM\ManyToOne(targetEntity=Seccion::class)
  36. */
  37. private $seccionClon;
  38. /**
  39. * @ORM\OneToMany(targetEntity="App\Core\Entity\EstudianteCurso", mappedBy="seccion")
  40. */
  41. private $estudiantesCurso;
  42. /**
  43. * @ORM\OneToMany(targetEntity=MaestroCurso::class, mappedBy="seccion")
  44. */
  45. private $maestroCursos;
  46. /**
  47. * @ORM\OneToMany(targetEntity="App\Core\Entity\Curso", mappedBy="seccion")
  48. */
  49. private $cursos;
  50. public function __construct()
  51. {
  52. $this->estudiantesCurso = new ArrayCollection();
  53. $this->maestroCursos = new ArrayCollection();
  54. $this->cursos = new ArrayCollection();
  55. }
  56. public function getId(): ?int
  57. {
  58. return $this->id;
  59. }
  60. public function getNombre(): ?string
  61. {
  62. return $this->nombre;
  63. }
  64. public function setNombre(string $nombre): self
  65. {
  66. $this->nombre = $nombre;
  67. return $this;
  68. }
  69. public function getCorrelativo(): ?string
  70. {
  71. return $this->correlativo;
  72. }
  73. public function setCorrelativo(?string $correlativo): self
  74. {
  75. $this->correlativo = $correlativo;
  76. return $this;
  77. }
  78. public function getNivel(): ?Nivel
  79. {
  80. return $this->nivel;
  81. }
  82. public function setNivel(?Nivel $nivel): self
  83. {
  84. $this->nivel = $nivel;
  85. return $this;
  86. }
  87. public function getSeccionClon(): ?self
  88. {
  89. return $this->seccionClon;
  90. }
  91. public function setSeccionClon(?self $seccionClon): self
  92. {
  93. $this->seccionClon = $seccionClon;
  94. return $this;
  95. }
  96. /**
  97. * @return Collection|EstudianteCurso[]
  98. */
  99. public function getEstudiantesCurso(): Collection
  100. {
  101. return $this->estudiantesCurso;
  102. }
  103. public function addEstudianteCurso(EstudianteCurso $estudianteCurso): self
  104. {
  105. if (!$this->estudiantesCurso->contains($estudianteCurso)) {
  106. $this->estudiantesCurso[] = $estudianteCurso;
  107. $estudianteCurso->setSeccion($this);
  108. }
  109. return $this;
  110. }
  111. public function removeEstudianteCurso(EstudianteCurso $estudianteCurso): self
  112. {
  113. if ($this->estudiantesCurso->contains($estudianteCurso)) {
  114. $this->estudiantesCurso->removeElement($estudianteCurso);
  115. // set the owning side to null (unless already changed)
  116. if ($estudianteCurso->getSeccion() === $this) {
  117. $estudianteCurso->setSeccion(null);
  118. }
  119. }
  120. return $this;
  121. }
  122. /**
  123. * @return Collection<int, MaestroCurso>
  124. */
  125. public function getMaestroCursos(): Collection
  126. {
  127. return $this->maestroCursos;
  128. }
  129. public function addMaestroCurso(MaestroCurso $maestroCurso): self
  130. {
  131. if (!$this->maestroCursos->contains($maestroCurso)) {
  132. $this->maestroCursos[] = $maestroCurso;
  133. $maestroCurso->setSeccion($this);
  134. }
  135. return $this;
  136. }
  137. public function removeMaestroCurso(MaestroCurso $maestroCurso): self
  138. {
  139. if ($this->maestroCursos->removeElement($maestroCurso)) {
  140. // set the owning side to null (unless already changed)
  141. if ($maestroCurso->getSeccion() === $this) {
  142. $maestroCurso->setSeccion(null);
  143. }
  144. }
  145. return $this;
  146. }
  147. /**
  148. * @return Collection|Curso[]
  149. */
  150. public function getCursos(): Collection
  151. {
  152. return $this->cursos;
  153. }
  154. public function addCurso(Curso $curso): self
  155. {
  156. if (!$this->cursos->contains($curso)) {
  157. $this->cursos[] = $curso;
  158. $curso->setSeccion($this);
  159. }
  160. return $this;
  161. }
  162. public function removeCurso(Curso $curso): self
  163. {
  164. if ($this->cursos->removeElement($curso)) {
  165. // set the owning side to null (unless already changed)
  166. if ($curso->getSeccion() === $this) {
  167. $curso->setSeccion(null);
  168. }
  169. }
  170. return $this;
  171. }
  172. }