<?php
namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity
* @ORM\Table(name="buena_practica")
*/
#[Vich\Uploadable]
class BuenaPractica extends \App\Entity\BaseEntity
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $titulo;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $descripcion;
/**
* @ORM\Column(type="datetime", nullable=true, name="fecha_publicacion")
*/
private $dateApprove;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default":false})
*/
private $approve;
/**
* @ORM\Column(type="datetime", nullable=true, name="deleted_at")
*/
private $deletedAt;
/**
* @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
* @Gedmo\Timestampable(on="update")
*/
private $updatedAt;
/**
* @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
* @Gedmo\Timestampable(on="create")
*/
private $createdAt;
/**
* @ORM\ManyToOne(targetEntity=\App\Entity\PropietarioContenido::class, inversedBy="buenasPracticas")
* @ORM\JoinColumn(name="creador", referencedColumnName="id")
*/
private $creador;
/**
* @ORM\Column(type="date", nullable=true, name="fecha_visible")
*/
private ?\DateTimeInterface $fechaPublicacion = null;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private ?string $url = null;
#[Vich\UploadableField(mapping: 'buena_practica_imagen', fileNameProperty: 'imagenNombre')]
private ?File $imagenFile = null;
/**
* @ORM\Column(type="string", length=255, nullable=true, name="imagen_nombre")
*/
private ?string $imagenNombre = null;
#[Vich\UploadableField(mapping: 'buena_practica_documento', fileNameProperty: 'documentoNombre')]
private ?File $documentoFile = null;
/**
* @ORM\Column(type="string", length=255, nullable=true, name="documento_nombre")
*/
private ?string $documentoNombre = null;
public function getId(): ?int
{
return $this->id;
}
public function getTitulo(): ?string
{
return $this->titulo;
}
public function setTitulo(?string $titulo): static
{
$this->titulo = $titulo;
return $this;
}
public function getDescripcion(): ?string
{
return $this->descripcion;
}
public function setDescripcion(?string $descripcion): static
{
$this->descripcion = $descripcion;
return $this;
}
public function getDateApprove(): ?\DateTimeInterface
{
return $this->dateApprove;
}
public function setDateApprove(?\DateTimeInterface $dateApprove): static
{
$this->dateApprove = $dateApprove;
return $this;
}
public function isApprove(): ?bool
{
return $this->approve;
}
public function setApprove(?bool $approve): static
{
$this->approve = $approve;
return $this;
}
public function getDeletedAt(): ?\DateTimeInterface
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTimeInterface $deletedAt): static
{
$this->deletedAt = $deletedAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeInterface $updatedAt): static
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function getCreador(): ?PropietarioContenido
{
return $this->creador;
}
public function setCreador(?PropietarioContenido $creador): static
{
$this->creador = $creador;
return $this;
}
public function getFechaPublicacion(): ?\DateTimeInterface
{
return $this->fechaPublicacion;
}
public function setFechaPublicacion(?\DateTimeInterface $fechaPublicacion): static
{
$this->fechaPublicacion = $fechaPublicacion;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): static
{
$this->url = $url;
return $this;
}
public function getImagenFile(): ?File
{
return $this->imagenFile;
}
public function setImagenFile(?File $imagenFile = null): void
{
$this->imagenFile = $imagenFile;
if (null !== $imagenFile) {
// Forzar actualización para que Doctrine detecte el cambio
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getImagenNombre(): ?string
{
return $this->imagenNombre;
}
public function setImagenNombre(?string $imagenNombre): static
{
$this->imagenNombre = $imagenNombre;
return $this;
}
public function getDocumentoFile(): ?File
{
return $this->documentoFile;
}
public function setDocumentoFile(?File $documentoFile = null): void
{
$this->documentoFile = $documentoFile;
if (null !== $documentoFile) {
// Forzar actualización para que Doctrine detecte el cambio
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getDocumentoNombre(): ?string
{
return $this->documentoNombre;
}
public function setDocumentoNombre(?string $documentoNombre): static
{
$this->documentoNombre = $documentoNombre;
return $this;
}
}