src/Entity/BuenaPractica.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\DBAL\Types\Types;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. /**
  9. * @ORM\Entity
  10. * @ORM\Table(name="buena_practica")
  11. */
  12. #[Vich\Uploadable]
  13. class BuenaPractica extends \App\Entity\BaseEntity
  14. {
  15. /**
  16. * @ORM\Id
  17. * @ORM\Column(type="integer")
  18. * @ORM\GeneratedValue(strategy="AUTO")
  19. */
  20. private $id;
  21. /**
  22. * @ORM\Column(type="string", nullable=true)
  23. */
  24. private $titulo;
  25. /**
  26. * @ORM\Column(type="text", nullable=true)
  27. */
  28. private $descripcion;
  29. /**
  30. * @ORM\Column(type="datetime", nullable=true, name="fecha_publicacion")
  31. */
  32. private $dateApprove;
  33. /**
  34. * @ORM\Column(type="boolean", nullable=true, options={"default":false})
  35. */
  36. private $approve;
  37. /**
  38. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  39. */
  40. private $deletedAt;
  41. /**
  42. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
  43. * @Gedmo\Timestampable(on="update")
  44. */
  45. private $updatedAt;
  46. /**
  47. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
  48. * @Gedmo\Timestampable(on="create")
  49. */
  50. private $createdAt;
  51. /**
  52. * @ORM\ManyToOne(targetEntity=\App\Entity\PropietarioContenido::class, inversedBy="buenasPracticas")
  53. * @ORM\JoinColumn(name="creador", referencedColumnName="id")
  54. */
  55. private $creador;
  56. /**
  57. * @ORM\Column(type="date", nullable=true, name="fecha_visible")
  58. */
  59. private ?\DateTimeInterface $fechaPublicacion = null;
  60. /**
  61. * @ORM\Column(type="string", length=500, nullable=true)
  62. */
  63. private ?string $url = null;
  64. #[Vich\UploadableField(mapping: 'buena_practica_imagen', fileNameProperty: 'imagenNombre')]
  65. private ?File $imagenFile = null;
  66. /**
  67. * @ORM\Column(type="string", length=255, nullable=true, name="imagen_nombre")
  68. */
  69. private ?string $imagenNombre = null;
  70. #[Vich\UploadableField(mapping: 'buena_practica_documento', fileNameProperty: 'documentoNombre')]
  71. private ?File $documentoFile = null;
  72. /**
  73. * @ORM\Column(type="string", length=255, nullable=true, name="documento_nombre")
  74. */
  75. private ?string $documentoNombre = null;
  76. public function getId(): ?int
  77. {
  78. return $this->id;
  79. }
  80. public function getTitulo(): ?string
  81. {
  82. return $this->titulo;
  83. }
  84. public function setTitulo(?string $titulo): static
  85. {
  86. $this->titulo = $titulo;
  87. return $this;
  88. }
  89. public function getDescripcion(): ?string
  90. {
  91. return $this->descripcion;
  92. }
  93. public function setDescripcion(?string $descripcion): static
  94. {
  95. $this->descripcion = $descripcion;
  96. return $this;
  97. }
  98. public function getDateApprove(): ?\DateTimeInterface
  99. {
  100. return $this->dateApprove;
  101. }
  102. public function setDateApprove(?\DateTimeInterface $dateApprove): static
  103. {
  104. $this->dateApprove = $dateApprove;
  105. return $this;
  106. }
  107. public function isApprove(): ?bool
  108. {
  109. return $this->approve;
  110. }
  111. public function setApprove(?bool $approve): static
  112. {
  113. $this->approve = $approve;
  114. return $this;
  115. }
  116. public function getDeletedAt(): ?\DateTimeInterface
  117. {
  118. return $this->deletedAt;
  119. }
  120. public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  121. {
  122. $this->deletedAt = $deletedAt;
  123. return $this;
  124. }
  125. public function getUpdatedAt(): ?\DateTimeInterface
  126. {
  127. return $this->updatedAt;
  128. }
  129. public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  130. {
  131. $this->updatedAt = $updatedAt;
  132. return $this;
  133. }
  134. public function getCreatedAt(): ?\DateTimeInterface
  135. {
  136. return $this->createdAt;
  137. }
  138. public function setCreatedAt(\DateTimeInterface $createdAt): static
  139. {
  140. $this->createdAt = $createdAt;
  141. return $this;
  142. }
  143. public function getCreador(): ?PropietarioContenido
  144. {
  145. return $this->creador;
  146. }
  147. public function setCreador(?PropietarioContenido $creador): static
  148. {
  149. $this->creador = $creador;
  150. return $this;
  151. }
  152. public function getFechaPublicacion(): ?\DateTimeInterface
  153. {
  154. return $this->fechaPublicacion;
  155. }
  156. public function setFechaPublicacion(?\DateTimeInterface $fechaPublicacion): static
  157. {
  158. $this->fechaPublicacion = $fechaPublicacion;
  159. return $this;
  160. }
  161. public function getUrl(): ?string
  162. {
  163. return $this->url;
  164. }
  165. public function setUrl(?string $url): static
  166. {
  167. $this->url = $url;
  168. return $this;
  169. }
  170. public function getImagenFile(): ?File
  171. {
  172. return $this->imagenFile;
  173. }
  174. public function setImagenFile(?File $imagenFile = null): void
  175. {
  176. $this->imagenFile = $imagenFile;
  177. if (null !== $imagenFile) {
  178. // Forzar actualización para que Doctrine detecte el cambio
  179. $this->updatedAt = new \DateTimeImmutable();
  180. }
  181. }
  182. public function getImagenNombre(): ?string
  183. {
  184. return $this->imagenNombre;
  185. }
  186. public function setImagenNombre(?string $imagenNombre): static
  187. {
  188. $this->imagenNombre = $imagenNombre;
  189. return $this;
  190. }
  191. public function getDocumentoFile(): ?File
  192. {
  193. return $this->documentoFile;
  194. }
  195. public function setDocumentoFile(?File $documentoFile = null): void
  196. {
  197. $this->documentoFile = $documentoFile;
  198. if (null !== $documentoFile) {
  199. // Forzar actualización para que Doctrine detecte el cambio
  200. $this->updatedAt = new \DateTimeImmutable();
  201. }
  202. }
  203. public function getDocumentoNombre(): ?string
  204. {
  205. return $this->documentoNombre;
  206. }
  207. public function setDocumentoNombre(?string $documentoNombre): static
  208. {
  209. $this->documentoNombre = $documentoNombre;
  210. return $this;
  211. }
  212. }