src/Asistencia/Entity/Clase.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Asistencia\Entity;
  3. use App\Core\Entity\Curso;
  4. use App\Asistencia\Entity\Comentario;
  5. use App\Asistencia\Entity\Asistencia;
  6. use App\Asistencia\Entity\RegistroEvaluacion;
  7. use App\Core\Entity\PuntuacionClase;
  8. use App\Entity\ClaseArchivo;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\Serializer\Annotation\Groups;
  13. /**
  14. * @ORM\Entity(repositoryClass="App\Asistencia\Repository\ClaseRepository")
  15. */
  16. class Clase
  17. {
  18. /**
  19. * @ORM\Id()
  20. * @ORM\GeneratedValue()
  21. * @ORM\Column(type="integer")
  22. * @Groups({"main", "asistencia"})
  23. */
  24. private $id;
  25. /**
  26. * @ORM\ManyToOne(targetEntity="App\Core\Entity\Curso", inversedBy="clases")
  27. * @ORM\JoinColumn(nullable=false)
  28. */
  29. private $curso;
  30. /**
  31. * @ORM\Column(type="date")
  32. * @Groups("asistencia")
  33. */
  34. private $fecha;
  35. /**
  36. * @ORM\Column(type="time")
  37. */
  38. private $horaInicio;
  39. /**
  40. * @ORM\Column(type="time")
  41. */
  42. private $horaFin;
  43. /**
  44. * @ORM\Column(type="integer")
  45. * 0 = programado, 1 = cancelada, 2 = terminada
  46. * @Groups("main")
  47. */
  48. private $estado;
  49. /**
  50. * @ORM\Column(type="string", length=255)
  51. */
  52. private $titulo;
  53. /**
  54. * @ORM\OneToMany(targetEntity="App\Asistencia\Entity\Objetivo", mappedBy="clase", orphanRemoval=true)
  55. */
  56. private $objetivos;
  57. /**
  58. * @ORM\OneToMany(targetEntity="App\Asistencia\Entity\Comentario", mappedBy="clase", orphanRemoval=true)
  59. */
  60. private $comentarios;
  61. /**
  62. * @ORM\OneToMany(targetEntity="App\Asistencia\Entity\Asistencia", mappedBy="clase", orphanRemoval=true)
  63. */
  64. private $asistencias;
  65. /**
  66. * @ORM\OneToMany(targetEntity="App\Asistencia\Entity\RegistroEvaluacion", mappedBy="clase", orphanRemoval=true)
  67. */
  68. private $registroEvaluaciones;
  69. /**
  70. * @ORM\OneToMany(targetEntity=PuntuacionClase::class, mappedBy="clase", orphanRemoval=true)
  71. */
  72. private $puntuaciones;
  73. /**
  74. * @ORM\Column(type="float", nullable=true)
  75. */
  76. private $puntuacionPromedio;
  77. /**
  78. * @ORM\OneToMany(targetEntity=ClaseArchivo::class, mappedBy="clase")
  79. */
  80. private $claseArchivos;
  81. public function __construct()
  82. {
  83. $this->objetivos = new ArrayCollection();
  84. $this->comentarios = new ArrayCollection();
  85. $this->asistencias = new ArrayCollection();
  86. $this->registroEvaluaciones = new ArrayCollection();
  87. $this->puntuaciones = new ArrayCollection();
  88. $this->claseArchivos = new ArrayCollection();
  89. }
  90. public function getId(): ?int
  91. {
  92. return $this->id;
  93. }
  94. public function getCurso(): ?Curso
  95. {
  96. return $this->curso;
  97. }
  98. public function setCurso(?Curso $curso): self
  99. {
  100. $this->curso = $curso;
  101. return $this;
  102. }
  103. public function getFecha(): ?\DateTimeInterface
  104. {
  105. return $this->fecha;
  106. }
  107. public function setFecha(\DateTimeInterface $fecha): self
  108. {
  109. $this->fecha = $fecha;
  110. return $this;
  111. }
  112. public function getHoraInicio(): ?\DateTimeInterface
  113. {
  114. return $this->horaInicio;
  115. }
  116. public function setHoraInicio(\DateTimeInterface $horaInicio): self
  117. {
  118. $this->horaInicio = $horaInicio;
  119. return $this;
  120. }
  121. public function getHoraFin(): ?\DateTimeInterface
  122. {
  123. return $this->horaFin;
  124. }
  125. public function setHoraFin(\DateTimeInterface $horaFin): self
  126. {
  127. $this->horaFin = $horaFin;
  128. return $this;
  129. }
  130. public function getEstado(): ?int
  131. {
  132. return $this->estado;
  133. }
  134. public function setEstado(int $estado): self
  135. {
  136. $this->estado = $estado;
  137. return $this;
  138. }
  139. public function getTitulo(): ?string
  140. {
  141. return $this->titulo;
  142. }
  143. public function setTitulo(string $titulo): self
  144. {
  145. $this->titulo = $titulo;
  146. return $this;
  147. }
  148. /**
  149. * @return Collection|Objetivo[]
  150. */
  151. public function getObjetivos(): Collection
  152. {
  153. return $this->objetivos;
  154. }
  155. public function addObjetivo(Objetivo $objetivo): self
  156. {
  157. if (!$this->objetivos->contains($objetivo)) {
  158. $this->objetivos[] = $objetivo;
  159. $objetivo->setClase($this);
  160. }
  161. return $this;
  162. }
  163. public function removeObjetivo(Objetivo $objetivo): self
  164. {
  165. if ($this->objetivos->contains($objetivo)) {
  166. $this->objetivos->removeElement($objetivo);
  167. // set the owning side to null (unless already changed)
  168. if ($objetivo->getClase() === $this) {
  169. $objetivo->setClase(null);
  170. }
  171. }
  172. return $this;
  173. }
  174. /**
  175. * @return Collection|Comentario[]
  176. */
  177. public function getComentarios(): Collection
  178. {
  179. return $this->comentarios;
  180. }
  181. public function addComentario(Comentario $comentario): self
  182. {
  183. if (!$this->comentarios->contains($comentario)) {
  184. $this->comentarios[] = $comentario;
  185. $comentario->setClase($this);
  186. }
  187. return $this;
  188. }
  189. public function removeComentario(Comentario $comentario): self
  190. {
  191. if ($this->comentarios->contains($comentario)) {
  192. $this->comentarios->removeElement($comentario);
  193. // set the owning side to null (unless already changed)
  194. if ($comentario->getClase() === $this) {
  195. $comentario->setClase(null);
  196. }
  197. }
  198. return $this;
  199. }
  200. /**
  201. * @return Collection|Asistencia[]
  202. */
  203. public function getAsistencias(): Collection
  204. {
  205. return $this->asistencias;
  206. }
  207. public function addAsistencia(Asistencia $asistencia): self
  208. {
  209. if (!$this->asistencias->contains($asistencia)) {
  210. $this->asistencias[] = $asistencia;
  211. $asistencia->setClase($this);
  212. }
  213. return $this;
  214. }
  215. public function removeAsistencia(Asistencia $asistencia): self
  216. {
  217. if ($this->asistencias->contains($asistencia)) {
  218. $this->asistencias->removeElement($asistencia);
  219. // set the owning side to null (unless already changed)
  220. if ($asistencia->getClase() === $this) {
  221. $asistencia->setClase(null);
  222. }
  223. }
  224. return $this;
  225. }
  226. /**
  227. * @return Collection|RegistroEvaluacion[]
  228. */
  229. public function getRegistroEvaluaciones(): Collection
  230. {
  231. return $this->registroEvaluaciones;
  232. }
  233. public function addRegistroEvaluacione(RegistroEvaluacion $registroEvaluacione): self
  234. {
  235. if (!$this->registroEvaluaciones->contains($registroEvaluacione)) {
  236. $this->registroEvaluaciones[] = $registroEvaluacione;
  237. $registroEvaluacione->setClase($this);
  238. }
  239. return $this;
  240. }
  241. public function removeRegistroEvaluacione(RegistroEvaluacion $registroEvaluacione): self
  242. {
  243. if ($this->registroEvaluaciones->contains($registroEvaluacione)) {
  244. $this->registroEvaluaciones->removeElement($registroEvaluacione);
  245. // set the owning side to null (unless already changed)
  246. if ($registroEvaluacione->getClase() === $this) {
  247. $registroEvaluacione->setClase(null);
  248. }
  249. }
  250. return $this;
  251. }
  252. /**
  253. * @return Collection|PuntuacionClase[]
  254. */
  255. public function getPuntuaciones(): Collection
  256. {
  257. return $this->puntuaciones;
  258. }
  259. public function addPuntuacione(PuntuacionClase $puntuacion): self
  260. {
  261. if (!$this->puntuaciones->contains($puntuacion)) {
  262. $this->puntuaciones[] = $puntuacion;
  263. $puntuacion->setClase($this);
  264. }
  265. return $this;
  266. }
  267. public function removePuntuacione(PuntuacionClase $puntuacion): self
  268. {
  269. if ($this->puntuaciones->contains($puntuacion)) {
  270. $this->puntuaciones->removeElement($puntuacion);
  271. // set the owning side to null (unless already changed)
  272. if ($puntuacion->getClase() === $this) {
  273. $puntuacion->setClase(null);
  274. }
  275. }
  276. return $this;
  277. }
  278. /**
  279. * @return float
  280. */
  281. public function getPuntuacionPromedio(): ?float
  282. {
  283. return $this->puntuacionPromedio;
  284. }
  285. /**
  286. * @param float $puntuacionPromedio
  287. */
  288. public function setPuntuacionPromedio(float $puntuacionPromedio): void
  289. {
  290. $this->puntuacionPromedio = $puntuacionPromedio;
  291. }
  292. /**
  293. * @return Collection<int, ClaseArchivo>
  294. */
  295. public function getClaseArchivos(): Collection
  296. {
  297. return $this->claseArchivos;
  298. }
  299. public function addClaseArchivo(ClaseArchivo $claseArchivo): self
  300. {
  301. if (!$this->claseArchivos->contains($claseArchivo)) {
  302. $this->claseArchivos[] = $claseArchivo;
  303. $claseArchivo->setClase($this);
  304. }
  305. return $this;
  306. }
  307. public function removeClaseArchivo(ClaseArchivo $claseArchivo): self
  308. {
  309. if ($this->claseArchivos->removeElement($claseArchivo)) {
  310. // set the owning side to null (unless already changed)
  311. if ($claseArchivo->getClase() === $this) {
  312. $claseArchivo->setClase(null);
  313. }
  314. }
  315. return $this;
  316. }
  317. }