<?phpnamespace App\Entity;use App\Repository\RolesRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: RolesRepository::class)]class Roles{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $role = null; #[ORM\ManyToMany(targetEntity: Routes::class, mappedBy: 'roles')] private Collection $routes; #[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'roles_user')] private Collection $users; #[ORM\ManyToMany(targetEntity: UserOdoo::class, mappedBy: 'roles_user')] private Collection $usersOdoo; public function __construct() { $this->routes = new ArrayCollection(); $this->users = new ArrayCollection(); $this->usersOdoo = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getRole(): ?string { return $this->role; } public function setRole(string $role): self { $this->role = $role; return $this; } /** * @return Collection<int, Routes> */ public function getRoutes(): Collection { return $this->routes; } public function addRoute(Routes $route): self { if (!$this->routes->contains($route)) { $this->routes->add($route); $route->addRole($this); } return $this; } public function removeRoute(Routes $route): self { if ($this->routes->removeElement($route)) { $route->removeRole($this); } return $this; } /** * @return Collection<int, User> */ public function getUsers(): Collection { return $this->users; } public function addUser(User $user): self { if (!$this->users->contains($user)) { $this->users->add($user); $user->addRolesUser($this); } return $this; } public function removeUser(User $user): self { if ($this->users->removeElement($user)) { $user->removeRolesUser($this); } return $this; } /** * @return Collection<int, UserOdoo> */ public function getUsersOdoo(): Collection { return $this->usersOdoo; } public function addUserOdoo(UserOdoo $user): self { if (!$this->usersOdoo->contains($user)) { $this->usersOdoo->add($user); $user->addRolesUser($this); } return $this; } public function removeUserOdoo(UserOdoo $user): self { if ($this->usersOdoo->removeElement($user)) { $user->removeRolesUser($this); } return $this; }}