<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity
* @ORM\Table(name="contenido_html")
*/
class ContenidoHTML
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $slug;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $titulo;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $contenido;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $publico;
/**
* @ORM\Column(type="string", nullable=true, name="creado_por")
*/
private $creadoPor;
/**
* @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\OneToMany(targetEntity=\App\Entity\MenuItem::class, mappedBy="contenidoHTML")
*/
private $menuItems;
public function __construct()
{
$this->menuItems = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): static
{
$this->slug = $slug;
return $this;
}
public function getTitulo(): ?array
{
return $this->titulo;
}
public function setTitulo(?array $titulo): static
{
$this->titulo = $titulo;
return $this;
}
public function getContenido(): ?array
{
return $this->contenido;
}
public function setContenido(?array $contenido): static
{
$this->contenido = $contenido;
return $this;
}
public function isPublico(): ?bool
{
return $this->publico;
}
public function setPublico(?bool $publico): static
{
$this->publico = $publico;
return $this;
}
public function getCreadoPor(): ?string
{
return $this->creadoPor;
}
public function setCreadoPor(?string $creadoPor): static
{
$this->creadoPor = $creadoPor;
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;
}
/**
* @return Collection<int, MenuItem>
*/
public function getMenuItems(): Collection
{
return $this->menuItems;
}
public function addMenuItem(MenuItem $menuItem): static
{
if (!$this->menuItems->contains($menuItem)) {
$this->menuItems->add($menuItem);
$menuItem->setContenidoHTML($this);
}
return $this;
}
public function removeMenuItem(MenuItem $menuItem): static
{
if ($this->menuItems->removeElement($menuItem)) {
// set the owning side to null (unless already changed)
if ($menuItem->getContenidoHTML() === $this) {
$menuItem->setContenidoHTML(null);
}
}
return $this;
}
}