src/Entity/Materia.php line 36

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Asistencia\Entity\Anuncio;
  4. use App\Asistencia\Entity\Clase;
  5. use App\Asistencia\Entity\Evaluacion;
  6. use App\Core\Entity\CategoriaCurso;
  7. use App\Core\Entity\Chat\Conversacion;
  8. use App\Core\Entity\Color;
  9. use App\Core\Entity\Curso;
  10. use App\Core\Entity\Direccion;
  11. use App\Core\Entity\EstudianteCurso;
  12. use App\Core\Entity\EstudianteCursoRol;
  13. use App\Core\Entity\Horario;
  14. use App\Core\Entity\Institucion\Nivel;
  15. use App\Core\Entity\Maestro;
  16. use App\Core\Entity\MaestroCurso;
  17. use App\Core\Entity\Notificacion;
  18. use App\Core\Entity\PuntuacionCurso;
  19. use App\Core\Entity\SolicitudAsignacion;
  20. use App\Core\Entity\Subscripciones\HistorialPagoSubscripcion;
  21. use App\Core\Entity\Subscripciones\PagoSubscripcion;
  22. use App\Repository\MateriaRepository;
  23. use Doctrine\Common\Collections\ArrayCollection;
  24. use Doctrine\Common\Collections\Collection;
  25. use Doctrine\ORM\Mapping as ORM;
  26. use Symfony\Component\HttpFoundation\File\File;
  27. use Symfony\Component\HttpFoundation\File\UploadedFile;
  28. use Symfony\Component\Serializer\Annotation\Groups;
  29. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  30. /**
  31. * @ORM\Entity(repositoryClass=MateriaRepository::class)
  32. */
  33. class Materia
  34. {
  35. const JSON_FIELDS = ['id', 'nombre', 'abreviatura', 'curso' => ["id", "nivel"]];
  36. /**
  37. * @ORM\Id()
  38. * @ORM\GeneratedValue()
  39. * @ORM\Column(type="integer")
  40. * @Groups("materia")
  41. */
  42. private $id;
  43. /**
  44. * @ORM\Column(type="string", length=100)
  45. * @Groups("materia")
  46. */
  47. private $nombre;
  48. /**
  49. * @ORM\Column(type="text")
  50. * @Groups("materia")
  51. */
  52. private $abreviatura;
  53. /**
  54. * @ORM\OneToOne(targetEntity=Curso::class, mappedBy="materia", cascade={"persist", "remove"})
  55. */
  56. private $curso;
  57. /**
  58. * @ORM\ManyToOne(targetEntity=Materia::class, inversedBy="MateriaClon")
  59. */
  60. private $materia;
  61. /**
  62. * @ORM\OneToMany(targetEntity=Materia::class, mappedBy="materia")
  63. */
  64. private $MateriaClon;
  65. public function __construct()
  66. {
  67. $this->MateriaClon = new ArrayCollection();
  68. }
  69. public function getId(): ?int
  70. {
  71. return $this->id;
  72. }
  73. public function getNombre(): ?string
  74. {
  75. return $this->nombre;
  76. }
  77. public function setNombre(string $nombre): self
  78. {
  79. $this->nombre = $nombre;
  80. return $this;
  81. }
  82. public function getAbreviatura(): ?string
  83. {
  84. return $this->abreviatura;
  85. }
  86. public function setAbreviatura(string $abreviatura): self
  87. {
  88. $this->abreviatura = $abreviatura;
  89. return $this;
  90. }
  91. public function getCurso(): ?Curso
  92. {
  93. return $this->curso;
  94. }
  95. public function setCurso(?Curso $curso): self
  96. {
  97. $this->curso = $curso;
  98. return $this;
  99. }
  100. public function getMateria(): ?self
  101. {
  102. return $this->materia;
  103. }
  104. public function setMateria(?self $materia): self
  105. {
  106. $this->materia = $materia;
  107. return $this;
  108. }
  109. /**
  110. * @return Collection<int, self>
  111. */
  112. public function getMateriaClon(): Collection
  113. {
  114. return $this->MateriaClon;
  115. }
  116. public function addMateriaClon(self $materiaClon): self
  117. {
  118. if (!$this->MateriaClon->contains($materiaClon)) {
  119. $this->MateriaClon[] = $materiaClon;
  120. $materiaClon->setMateria($this);
  121. }
  122. return $this;
  123. }
  124. public function removeMateriaClon(self $materiaClon): self
  125. {
  126. if ($this->MateriaClon->removeElement($materiaClon)) {
  127. // set the owning side to null (unless already changed)
  128. if ($materiaClon->getMateria() === $this) {
  129. $materiaClon->setMateria(null);
  130. }
  131. }
  132. return $this;
  133. }
  134. }