<?phpnamespace App\Entity;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;/** * @Gedmo\Tree(type="nested") * @ORM\Entity(repositoryClass="App\Repository\MenuTreeRepository") * @ORM\Table(name="app_menu") * NestedTreeRepository */class MenuTree{ /** * @ORM\Id() * @ORM\GeneratedValue(strategy="IDENTITY") * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string") */ private $libelle; /** * @Gedmo\TreeLeft * @ORM\Column(type="integer") */ private $lft; /** * @Gedmo\TreeRight * @ORM\Column(type="integer") */ private $rgt; /** * @Gedmo\TreeParent * @ORM\ManyToOne(targetEntity="MenuTree", inversedBy="children") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE") */ private $parent; /** * @Gedmo\TreeRoot * @ORM\Column(type="integer", nullable=true) */ private $root; /** * @Gedmo\TreeLevel * @ORM\Column(name="lvl", type="integer") */ private $level; /** * @ORM\OneToMany(targetEntity="MenuTree", mappedBy="parent") */ private $children; /** * @ORM\Column(type="string", nullable=true) */ private $icon; /** * @ORM\Column(type="string", nullable=true) */ private $route; /** * @ORM\Column(type="string", nullable=true) */ private $role; public function getId(): ?int { return $this->id; } public function getLibelle(): ?string { return $this->libelle; } public function setLibelle(string $libelle): self { $this->libelle = $libelle; return $this; } /** * @return mixed */ public function getIcon() { return $this->icon; } /** * @param mixed $icon * @return MenuTree */ public function setIcon($icon) { $this->icon = $icon; return $this; } /** * @return mixed */ public function getLft() { return $this->lft; } /** * @param mixed $lft * @return MenuTree */ public function setLft($lft) { $this->lft = $lft; return $this; } /** * @return mixed */ public function getRgt() { return $this->rgt; } /** * @param mixed $rgt * @return MenuTree */ public function setRgt($rgt) { $this->rgt = $rgt; return $this; } /** * @return mixed */ public function getParent() { return $this->parent; } /** * @param mixed $parent * @return MenuTree */ public function setParent($parent) { $this->parent = $parent; return $this; } /** * @return mixed */ public function isRoot() { return (bool)$this->root; } /** * @param mixed $root * @return MenuTree */ public function setRoot($root) { $this->root = $root; return $this; } /** * @return mixed */ public function getLevel() { return $this->level; } /** * @param mixed $level * @return MenuTree */ public function setLevel($level) { $this->level = $level; return $this; } /** * @return mixed */ public function getChildren() { return $this->children; } /** * @param mixed $children * @return MenuTree */ public function setChildren($children) { $this->children = $children; return $this; } /** * @return mixed */ public function getRoute() { return $this->route; } /** * @param mixed $route * @return MenuTree */ public function setRoute($route) { $this->route = $route; return $this; } /** * @return bool */ public function isLeaf() { return $this->lft + 1 == $this->rgt; } /** * @return mixed */ public function getRole() { return $this->role; } /** * @param mixed $role * @return MenuTree */ public function setRole($role) { $this->role = $role; return $this; }}