src/Entity/Route.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RouteRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassRouteRepository::class)]
  8. class Route implements \Stringable
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255nullabletrue)]
  15.     private $name;
  16.     #[ORM\Column(type'string'length255nullabletrue)]
  17.     private $menu_id;
  18.     #[ORM\Column(type'string'length255nullabletrue)]
  19.     private $menu_name;
  20.     #[ORM\ManyToMany(targetEntityDroit::class, mappedBy'routes')]
  21.     private $droits;
  22.     public function __construct()
  23.     {
  24.         $this->droits = new ArrayCollection();
  25.     }
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     public function getName(): ?string
  31.     {
  32.         return $this->name;
  33.     }
  34.     public function setName(?string $name): self
  35.     {
  36.         $this->name $name;
  37.         return $this;
  38.     }
  39.     public function getMenuId(): ?string
  40.     {
  41.         return $this->menu_id;
  42.     }
  43.     public function setMenuId(string $menu_id): self
  44.     {
  45.         $this->menu_id $menu_id;
  46.         return $this;
  47.     }
  48.     public function getMenuName(): ?string
  49.     {
  50.         return $this->menu_name;
  51.     }
  52.     public function setMenuName(?string $menu_name): self
  53.     {
  54.         $this->menu_name $menu_name;
  55.         return $this;
  56.     }
  57.     /**
  58.      * @return Collection|Droit[]
  59.      */
  60.     public function getDroits(): Collection
  61.     {
  62.         return $this->droits;
  63.     }
  64.     public function addDroit(Droit $droit): self
  65.     {
  66.         if (!$this->droits->contains($droit)) {
  67.             $this->droits[] = $droit;
  68.             $droit->addRoute($this);
  69.         }
  70.         return $this;
  71.     }
  72.     public function removeDroit(Droit $droit): self
  73.     {
  74.         if ($this->droits->removeElement($droit)) {
  75.             $droit->removeRoute($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function __toString(): string
  80.     {
  81.         return (string) $this->name;
  82.     }
  83. }