<?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="menu_item")
*/
class MenuItem
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=true, name="key_menu")
*/
private $key;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $categoria;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $titulo;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $enlace;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $ruta;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $params;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $orden;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $icon;
/**
* @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="padre")
*/
private $hijos;
/**
* @ORM\ManyToOne(targetEntity=\App\Entity\MenuItem::class, inversedBy="hijos")
* @ORM\JoinColumn(name="menu_item_id", referencedColumnName="id")
*/
private $padre;
/**
* @ORM\ManyToOne(targetEntity=\App\Entity\ContenidoHTML::class, inversedBy="menuItems")
* @ORM\JoinColumn(name="contenido_html_id", referencedColumnName="id")
*/
private $contenidoHTML;
public function __construct()
{
$this->hijos = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
return $this;
}
public function getKey(): ?string
{
return $this->key;
}
public function setKey(?string $key): static
{
$this->key = $key;
return $this;
}
public function getCategoria(): ?string
{
return $this->categoria;
}
public function setCategoria(?string $categoria): static
{
$this->categoria = $categoria;
return $this;
}
public function getTitulo(): ?string
{
return $this->titulo;
}
public function setTitulo(?string $titulo): static
{
$this->titulo = $titulo;
return $this;
}
public function getEnlace(): ?string
{
return $this->enlace;
}
public function setEnlace(?string $enlace): static
{
$this->enlace = $enlace;
return $this;
}
public function getRuta(): ?string
{
return $this->ruta;
}
public function setRuta(?string $ruta): static
{
$this->ruta = $ruta;
return $this;
}
public function getParams(): ?array
{
return $this->params;
}
public function setParams(?array $params): static
{
$this->params = $params;
return $this;
}
public function getOrden(): ?int
{
return $this->orden;
}
public function setOrden(?int $orden): static
{
$this->orden = $orden;
return $this;
}
public function getIcon(): ?string
{
return $this->icon;
}
public function setIcon(?string $icon): static
{
$this->icon = $icon;
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 getHijos(): Collection
{
return $this->hijos;
}
public function addHijo(MenuItem $hijo): static
{
if (!$this->hijos->contains($hijo)) {
$this->hijos->add($hijo);
$hijo->setPadre($this);
}
return $this;
}
public function removeHijo(MenuItem $hijo): static
{
if ($this->hijos->removeElement($hijo)) {
// set the owning side to null (unless already changed)
if ($hijo->getPadre() === $this) {
$hijo->setPadre(null);
}
}
return $this;
}
public function getPadre(): ?self
{
return $this->padre;
}
public function setPadre(?self $padre): static
{
$this->padre = $padre;
return $this;
}
public function getContenidoHTML(): ?ContenidoHTML
{
return $this->contenidoHTML;
}
public function setContenidoHTML(?ContenidoHTML $contenidoHTML): static
{
$this->contenidoHTML = $contenidoHTML;
return $this;
}
}