src/Core/Entity/Institucion/Nivel.php line 14

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