src/Core/Entity/Institucion/Campus.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Core\Entity\Institucion;
  3. use App\Core\Entity\Color;
  4. use App\Core\Entity\Direccion;
  5. use App\Core\Entity\Institucion\Institucion;
  6. use App\Core\Repository\Institucion\CampusRepository;
  7. use App\Core\Entity\Institucion\Programa;
  8. use App\Entity\CampusMaestro;
  9. use App\Entity\Ciclo;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. use Doctrine\Common\Collections\Collection;
  12. use Doctrine\ORM\Mapping as ORM;
  13. /**
  14. * @ORM\Entity(repositoryClass=CampusRepository::class)
  15. */
  16. class Campus
  17. {
  18. const JSON_FIELDS = ['id', 'nombre', 'descripcion', 'institucion' => ['id', 'nombre'], 'campusClon' => ['id', 'nombre'], 'color' => ['id', 'nombre'], 'programas' => Programa::JSON_FIELDS];
  19. /**
  20. * @ORM\Id
  21. * @ORM\GeneratedValue
  22. * @ORM\Column(type="integer")
  23. */
  24. private $id;
  25. /**
  26. * @ORM\Column(type="string", length=100)
  27. */
  28. private $nombre;
  29. /**
  30. * @ORM\Column(type="text", nullable=true)
  31. */
  32. private $descripcion;
  33. /**
  34. * @ORM\ManyToOne(targetEntity=Color::class)
  35. * @ORM\JoinColumn(nullable=false)
  36. */
  37. private $color;
  38. /**
  39. * @ORM\ManyToOne(targetEntity=Direccion::class)
  40. * @ORM\JoinColumn(nullable=true)
  41. */
  42. private $direccion;
  43. /**
  44. * @ORM\ManyToOne(targetEntity=Institucion::class, inversedBy="campuses")
  45. * @ORM\JoinColumn(nullable=false)
  46. */
  47. private $institucion;
  48. /**
  49. * @ORM\ManyToOne(targetEntity=Campus::class)
  50. * @ORM\JoinColumn(nullable=true)
  51. */
  52. private $campusClon;
  53. /**
  54. * @ORM\OneToMany(targetEntity=Programa::class, mappedBy="campus")
  55. */
  56. private $programas;
  57. /**
  58. * @ORM\Column(name="`virtual`", type="boolean", nullable=false)
  59. */
  60. private $virtual;
  61. /**
  62. * @ORM\OneToMany(targetEntity=CampusMaestro::class, mappedBy="Campus")
  63. */
  64. private $estado;
  65. public function __construct()
  66. {
  67. $this->programas = new ArrayCollection();
  68. $this->estado = new ArrayCollection();
  69. }
  70. public function getId(): ?int
  71. {
  72. return $this->id;
  73. }
  74. public function getNombre(): ?string
  75. {
  76. return $this->nombre;
  77. }
  78. public function setNombre(string $nombre): self
  79. {
  80. $this->nombre = $nombre;
  81. return $this;
  82. }
  83. public function getDescripcion(): ?string
  84. {
  85. return $this->descripcion;
  86. }
  87. public function setDescripcion(?string $descripcion): self
  88. {
  89. $this->descripcion = $descripcion;
  90. return $this;
  91. }
  92. public function getColor(): ?Color
  93. {
  94. return $this->color;
  95. }
  96. public function setColor(?Color $color): self
  97. {
  98. $this->color = $color;
  99. return $this;
  100. }
  101. public function getDireccion(): ?Direccion
  102. {
  103. return $this->direccion;
  104. }
  105. public function setDireccion(?Direccion $direccion): self
  106. {
  107. $this->direccion = $direccion;
  108. return $this;
  109. }
  110. public function getInstitucion(): ?Institucion
  111. {
  112. return $this->institucion;
  113. }
  114. public function setInstitucion(?Institucion $institucion): self
  115. {
  116. $this->institucion = $institucion;
  117. return $this;
  118. }
  119. public function getCampusClon(): ?Campus
  120. {
  121. return $this->campusClon;
  122. }
  123. public function setCampusClon(?Campus $campusClon): self
  124. {
  125. $this->campusClon = $campusClon;
  126. return $this;
  127. }
  128. /**
  129. * @return Collection|Programa[]
  130. */
  131. public function getProgramas(): Collection
  132. {
  133. return $this->programas;
  134. }
  135. public function addPrograma(Programa $programa): self
  136. {
  137. if (!$this->programas->contains($programa)) {
  138. $this->programas[] = $programa;
  139. $programa->setCampus($this);
  140. }
  141. return $this;
  142. }
  143. public function removePrograma(Programa $programa): self
  144. {
  145. if ($this->programas->removeElement($programa)) {
  146. // set the owning side to null (unless already changed)
  147. if ($programa->getCampus() === $this) {
  148. $programa->setCampus(null);
  149. }
  150. }
  151. return $this;
  152. }
  153. public function getVirtual(): ?bool
  154. {
  155. return $this->virtual;
  156. }
  157. public function setVirtual(?bool $virtual): self
  158. {
  159. $this->virtual = $virtual;
  160. return $this;
  161. }
  162. /**
  163. * @return Collection<int, CampusMaestro>
  164. */
  165. public function getEstado(): Collection
  166. {
  167. return $this->estado;
  168. }
  169. public function addEstado(CampusMaestro $estado): self
  170. {
  171. if (!$this->estado->contains($estado)) {
  172. $this->estado[] = $estado;
  173. $estado->setCampus($this);
  174. }
  175. return $this;
  176. }
  177. public function removeEstado(CampusMaestro $estado): self
  178. {
  179. if ($this->estado->removeElement($estado)) {
  180. // set the owning side to null (unless already changed)
  181. if ($estado->getCampus() === $this) {
  182. $estado->setCampus(null);
  183. }
  184. }
  185. return $this;
  186. }
  187. }