src/Asistencia/Entity/Anuncio.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Asistencia\Entity;
  3. use App\Core\Entity\Color;
  4. use App\Core\Entity\Curso;
  5. use App\Entity\Archivo;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Symfony\Component\HttpFoundation\File\UploadedFile;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11. * @ORM\Entity(repositoryClass="App\Asistencia\Repository\AnuncioRepository")
  12. * @Vich\Uploadable()
  13. */
  14. class Anuncio
  15. {
  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 $titulo;
  26. /**
  27. * @ORM\Column(type="text")
  28. */
  29. private $descripcion;
  30. /**
  31. * @ORM\Column(type="date", nullable=true)
  32. */
  33. private $fecha;
  34. /**
  35. * @ORM\Column(type="datetime", nullable=true)
  36. */
  37. private $fechaPublicacion;
  38. /**
  39. * @ORM\Column(type="time", nullable=true)
  40. */
  41. private $horaInicio;
  42. /**
  43. * @ORM\Column(type="time", nullable=true)
  44. */
  45. private $horaFin;
  46. /**
  47. * @ORM\ManyToOne(targetEntity="App\Core\Entity\Curso", inversedBy="anuncios")
  48. * @ORM\JoinColumn(nullable=false)
  49. */
  50. private $curso;
  51. /**
  52. * @ORM\ManyToOne(targetEntity="App\Core\Entity\Color")
  53. * @ORM\JoinColumn(nullable=false)
  54. */
  55. private $color;
  56. /**
  57. * NOTE: This is not a mapped field of entity metadata, just a simple property.
  58. *
  59. * @Vich\UploadableField(mapping="archivo_anuncio", fileNameProperty="nombreArchivo", size="tamanioArchivo")
  60. *
  61. * @var File|null
  62. */
  63. private $archivoFS;
  64. /**
  65. * @ORM\Column(type="string", length=200, nullable=true)
  66. *
  67. * @var string|null
  68. */
  69. private $nombreArchivo;
  70. /**
  71. * @ORM\Column(type="integer", nullable=true)
  72. *
  73. * @var int|null
  74. */
  75. private $tamanioArchivo;
  76. /**
  77. * @ORM\Column(type="boolean", nullable=false)
  78. */
  79. private $esEvento;
  80. /**
  81. * @ORM\ManyToOne(targetEntity=Archivo::class)
  82. */
  83. private $archivo;
  84. public function getId(): ?int
  85. {
  86. return $this->id;
  87. }
  88. public function getTitulo(): ?string
  89. {
  90. return $this->titulo;
  91. }
  92. public function setTitulo(string $titulo): self
  93. {
  94. $this->titulo = $titulo;
  95. return $this;
  96. }
  97. public function getDescripcion(): ?string
  98. {
  99. return $this->descripcion;
  100. }
  101. public function setDescripcion(string $descripcion): self
  102. {
  103. $this->descripcion = $descripcion;
  104. return $this;
  105. }
  106. public function getFecha(): ?\DateTimeInterface
  107. {
  108. return $this->fecha;
  109. }
  110. public function setFecha(?\DateTimeInterface $fecha): self
  111. {
  112. $this->fecha = $fecha;
  113. return $this;
  114. }
  115. public function getFechaPublicacion(): ?\DateTimeInterface
  116. {
  117. return $this->fechaPublicacion;
  118. }
  119. public function setFechaPublicacion(?\DateTimeInterface $fechaPublicacion): self
  120. {
  121. $this->fechaPublicacion = $fechaPublicacion;
  122. return $this;
  123. }
  124. public function getHoraInicio(): ?\DateTimeInterface
  125. {
  126. return $this->horaInicio;
  127. }
  128. public function setHoraInicio(?\DateTimeInterface $horaInicio): self
  129. {
  130. $this->horaInicio = $horaInicio;
  131. return $this;
  132. }
  133. public function getHoraFin(): ?\DateTimeInterface
  134. {
  135. return $this->horaFin;
  136. }
  137. public function setHoraFin(?\DateTimeInterface $horaFin): self
  138. {
  139. $this->horaFin = $horaFin;
  140. return $this;
  141. }
  142. public function getCurso(): ?Curso
  143. {
  144. return $this->curso;
  145. }
  146. public function setCurso(?Curso $curso): self
  147. {
  148. $this->curso = $curso;
  149. return $this;
  150. }
  151. public function getColor(): ?Color
  152. {
  153. return $this->color;
  154. }
  155. public function setColor(?Color $color): self
  156. {
  157. $this->color = $color;
  158. return $this;
  159. }
  160. /**
  161. * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  162. * of 'UploadedFile' is injected into this setter to trigger the update. If this
  163. * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  164. * must be able to accept an instance of 'File' as the bundle will inject one here
  165. * during Doctrine hydration.
  166. *
  167. * @param File|UploadedFile|null $uploadedFile
  168. */
  169. public function setArchivoFS(?File $archivoFS = null): void
  170. {
  171. $this->archivoFS = $archivoFS;
  172. if (null !== $archivoFS) {
  173. // It is required that at least one field changes if you are using doctrine
  174. // otherwise the event listeners won't be called and the file is lost
  175. $this->setTamanioArchivo($archivoFS->getSize());
  176. }
  177. }
  178. public function getArchivoFS(): ?File
  179. {
  180. return $this->archivoFS;
  181. }
  182. public function setNombreArchivo(?string $nombreArchivo): void
  183. {
  184. $this->nombreArchivo = $nombreArchivo;
  185. }
  186. public function getNombreArchivo(): ?string
  187. {
  188. return $this->nombreArchivo;
  189. }
  190. public function setTamanioArchivo(?int $tamanioArchivo): void
  191. {
  192. $this->tamanioArchivo = $tamanioArchivo;
  193. }
  194. public function getTamanioArchivo(): ?int
  195. {
  196. return $this->tamanioArchivo;
  197. }
  198. public function getEsEvento(): ?bool
  199. {
  200. return $this->esEvento;
  201. }
  202. public function setEsEvento(bool $esEvento): self
  203. {
  204. $this->esEvento = $esEvento;
  205. return $this;
  206. }
  207. public function getArchivo(): ?Archivo
  208. {
  209. return $this->archivo;
  210. }
  211. public function setArchivo(?Archivo $archivo): self
  212. {
  213. $this->archivo = $archivo;
  214. return $this;
  215. }
  216. }