src/Entity/Noticia.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9. * @ORM\Entity
  10. * @ORM\Table(name="noticia")
  11. */
  12. class Noticia
  13. {
  14. /**
  15. * @ORM\Id
  16. * @ORM\Column(type="integer")
  17. * @ORM\GeneratedValue(strategy="AUTO")
  18. */
  19. private $id;
  20. /**
  21. * @ORM\Column(type="string", nullable=true)
  22. */
  23. private $titulo;
  24. /**
  25. * @ORM\Column(type="string", nullable=true)
  26. */
  27. private $entrada;
  28. /**
  29. * @ORM\Column(type="text", nullable=true)
  30. */
  31. private $descripcion;
  32. /**
  33. * @ORM\Column(type="text", nullable=true)
  34. */
  35. private $contenido;
  36. /**
  37. * @ORM\Column(type="datetime", nullable=true, name="fecha_publicacion")
  38. */
  39. private $fechaPublicacion;
  40. /**
  41. * @ORM\Column(type="string", nullable=true)
  42. */
  43. private $imagen;
  44. /**
  45. * @ORM\Column(type="array", nullable=true)
  46. */
  47. private $estado;
  48. /**
  49. * @ORM\Column(type="datetime", nullable=true, name="fecha_noticia")
  50. */
  51. private $fechaNoticia;
  52. /**
  53. * @ORM\Column(type="boolean", nullable=true)
  54. */
  55. private $publica;
  56. /**
  57. * @ORM\Column(type="boolean", nullable=true)
  58. */
  59. private $visibilidad;
  60. /**
  61. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  62. */
  63. private $deletedAt;
  64. /**
  65. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
  66. * @Gedmo\Timestampable(on="update")
  67. */
  68. private $updatedAt;
  69. /**
  70. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
  71. * @Gedmo\Timestampable(on="create")
  72. */
  73. private $createdAt;
  74. /**
  75. * @ORM\OneToMany(targetEntity=\App\Entity\Enlace::class, mappedBy="noticia")
  76. */
  77. private $enlaces;
  78. /**
  79. * @ORM\ManyToOne(targetEntity=\App\Entity\CategoriaNoticia::class, inversedBy="noticias")
  80. * @ORM\JoinColumn(name="categoria_noticia_id", referencedColumnName="id")
  81. */
  82. private $categoriaNoticia;
  83. public function __construct()
  84. {
  85. $this->enlaces = new ArrayCollection();
  86. }
  87. public function getId(): ?int
  88. {
  89. return $this->id;
  90. }
  91. public function setId($id)
  92. {
  93. $this->id = $id;
  94. return $this;
  95. }
  96. public function getTitulo(): ?string
  97. {
  98. return $this->titulo;
  99. }
  100. public function setTitulo(?string $titulo): static
  101. {
  102. $this->titulo = $titulo;
  103. return $this;
  104. }
  105. public function getEntrada(): ?string
  106. {
  107. return $this->entrada;
  108. }
  109. public function setEntrada(?string $entrada): static
  110. {
  111. $this->entrada = $entrada;
  112. return $this;
  113. }
  114. public function getDescripcion(): ?string
  115. {
  116. return $this->descripcion;
  117. }
  118. public function setDescripcion(?string $descripcion): static
  119. {
  120. $this->descripcion = $descripcion;
  121. return $this;
  122. }
  123. public function getContenido(): ?string
  124. {
  125. return $this->contenido;
  126. }
  127. public function setContenido(?string $contenido): static
  128. {
  129. $this->contenido = $contenido;
  130. return $this;
  131. }
  132. public function getFechaPublicacion(): ?\DateTimeInterface
  133. {
  134. return $this->fechaPublicacion;
  135. }
  136. public function setFechaPublicacion(?\DateTimeInterface $fechaPublicacion): static
  137. {
  138. $this->fechaPublicacion = $fechaPublicacion;
  139. return $this;
  140. }
  141. public function getImagen(): ?string
  142. {
  143. return $this->imagen;
  144. }
  145. public function setImagen(?string $imagen): static
  146. {
  147. $this->imagen = $imagen;
  148. return $this;
  149. }
  150. public function getEstado(): ?array
  151. {
  152. return $this->estado;
  153. }
  154. public function setEstado(?array $estado): static
  155. {
  156. $this->estado = $estado;
  157. return $this;
  158. }
  159. public function getFechaNoticia(): ?\DateTimeInterface
  160. {
  161. return $this->fechaNoticia;
  162. }
  163. public function setFechaNoticia(?\DateTimeInterface $fechaNoticia): static
  164. {
  165. $this->fechaNoticia = $fechaNoticia;
  166. return $this;
  167. }
  168. public function isPublica(): ?bool
  169. {
  170. return $this->publica;
  171. }
  172. public function setPublica(?bool $publica): static
  173. {
  174. $this->publica = $publica;
  175. return $this;
  176. }
  177. public function isVisibilidad(): ?bool
  178. {
  179. return $this->visibilidad;
  180. }
  181. public function setVisibilidad(?bool $visibilidad): static
  182. {
  183. $this->visibilidad = $visibilidad;
  184. return $this;
  185. }
  186. public function getDeletedAt(): ?\DateTimeInterface
  187. {
  188. return $this->deletedAt;
  189. }
  190. public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  191. {
  192. $this->deletedAt = $deletedAt;
  193. return $this;
  194. }
  195. public function getUpdatedAt(): ?\DateTimeInterface
  196. {
  197. return $this->updatedAt;
  198. }
  199. public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  200. {
  201. $this->updatedAt = $updatedAt;
  202. return $this;
  203. }
  204. public function getCreatedAt(): ?\DateTimeInterface
  205. {
  206. return $this->createdAt;
  207. }
  208. public function setCreatedAt(\DateTimeInterface $createdAt): static
  209. {
  210. $this->createdAt = $createdAt;
  211. return $this;
  212. }
  213. /**
  214. * @return Collection<int, Enlace>
  215. */
  216. public function getEnlaces(): Collection
  217. {
  218. return $this->enlaces;
  219. }
  220. public function addEnlace(Enlace $enlace): static
  221. {
  222. if (!$this->enlaces->contains($enlace)) {
  223. $this->enlaces->add($enlace);
  224. $enlace->setNoticia($this);
  225. }
  226. return $this;
  227. }
  228. public function removeEnlace(Enlace $enlace): static
  229. {
  230. if ($this->enlaces->removeElement($enlace)) {
  231. // set the owning side to null (unless already changed)
  232. if ($enlace->getNoticia() === $this) {
  233. $enlace->setNoticia(null);
  234. }
  235. }
  236. return $this;
  237. }
  238. public function getCategoriaNoticia(): ?CategoriaNoticia
  239. {
  240. return $this->categoriaNoticia;
  241. }
  242. public function setCategoriaNoticia(?CategoriaNoticia $categoriaNoticia): static
  243. {
  244. $this->categoriaNoticia = $categoriaNoticia;
  245. return $this;
  246. }
  247. }