<?php
namespace App\Entity;
use App\Repository\MenuRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MenuRepository::class)]
class Menu
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $titre = null;
#[ORM\Column(nullable: true)]
private ?bool $estActif = null;
#[ORM\Column(nullable: true)]
private ?bool $estMasque = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $route = null;
#[ORM\Column(nullable: true)]
private ?int $ordreAffichage = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $slug = null;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'menus')]
private ?self $menuparent = null;
#[ORM\OneToMany(mappedBy: 'menuparent', targetEntity: self::class)]
private Collection $menus;
#[ORM\OneToMany(mappedBy: 'menu', targetEntity: Publication::class)]
private Collection $publications;
public function __construct()
{
$this->menus = new ArrayCollection();
$this->publications = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function setTitre(string $titre): static
{
$this->titre = $titre;
return $this;
}
public function isEstActif(): ?bool
{
return $this->estActif;
}
public function setEstActif(?bool $estActif): static
{
$this->estActif = $estActif;
return $this;
}
public function isEstMasque(): ?bool
{
return $this->estMasque;
}
public function setEstMasque(?bool $estMasque): static
{
$this->estMasque = $estMasque;
return $this;
}
public function getRoute(): ?string
{
return $this->route;
}
public function setRoute(?string $route): static
{
$this->route = $route;
return $this;
}
public function getOrdreAffichage(): ?int
{
return $this->ordreAffichage;
}
public function setOrdreAffichage(?int $ordreAffichage): static
{
$this->ordreAffichage = $ordreAffichage;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): static
{
$this->slug = $slug;
return $this;
}
public function getMenuparent(): ?self
{
return $this->menuparent;
}
public function setMenuparent(?self $menuparent): static
{
$this->menuparent = $menuparent;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getMenus(): Collection
{
return $this->menus;
}
public function addMenu(self $menu): static
{
if (!$this->menus->contains($menu)) {
$this->menus->add($menu);
$menu->setMenuparent($this);
}
return $this;
}
public function removeMenu(self $menu): static
{
if ($this->menus->removeElement($menu)) {
// set the owning side to null (unless already changed)
if ($menu->getMenuparent() === $this) {
$menu->setMenuparent(null);
}
}
return $this;
}
/**
* @return Collection<int, Publication>
*/
public function getPublications(): Collection
{
return $this->publications;
}
public function addPublication(Publication $publication): static
{
if (!$this->publications->contains($publication)) {
$this->publications->add($publication);
$publication->setMenu($this);
}
return $this;
}
public function removePublication(Publication $publication): static
{
if ($this->publications->removeElement($publication)) {
// set the owning side to null (unless already changed)
if ($publication->getMenu() === $this) {
$publication->setMenu(null);
}
}
return $this;
}
}