src/Entity/Roles.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RolesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=RolesRepository::class)
  9.  */
  10. class Roles
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Establishments::class, inversedBy="roles")
  24.      * @ORM\JoinColumn(nullable=false)
  25.      */
  26.     private $establishment;
  27.     /**
  28.      * @ORM\Column(type="boolean")
  29.      */
  30.     private $deleted false;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=RolesAuthorizedActions::class, mappedBy="role")
  33.      */
  34.     private $rolesAuthorizedActions;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=Users::class, mappedBy="role")
  37.      */
  38.     private $users;
  39.     /**
  40.      * @ORM\Column(type="boolean")
  41.      */
  42.     private $notRemovable false;
  43.     /**
  44.      * @ORM\OneToMany(targetEntity=UserEstablishment::class, mappedBy="role")
  45.      */
  46.     private $userEstablishments;
  47.     public function __construct()
  48.     {
  49.         $this->rolesAuthorizedActions = new ArrayCollection();
  50.         $this->users = new ArrayCollection();
  51.         $this->userEstablishments = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getName(): ?string
  58.     {
  59.         return $this->name;
  60.     }
  61.     public function setName(string $name): self
  62.     {
  63.         $this->name $name;
  64.         return $this;
  65.     }
  66.     public function getEstablishment(): ?Establishments
  67.     {
  68.         return $this->establishment;
  69.     }
  70.     public function setEstablishment(?Establishments $establishment): self
  71.     {
  72.         $this->establishment $establishment;
  73.         return $this;
  74.     }
  75.     public function isDeleted(): ?bool
  76.     {
  77.         return $this->deleted;
  78.     }
  79.     public function setDeleted(bool $deleted): self
  80.     {
  81.         $this->deleted $deleted;
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return Collection<int, RolesAuthorizedActions>
  86.      */
  87.     public function getRolesAuthorizedActions(): Collection
  88.     {
  89.         return $this->rolesAuthorizedActions;
  90.     }
  91.     public function addRolesAuthorizedAction(RolesAuthorizedActions $rolesAuthorizedAction): self
  92.     {
  93.         if (!$this->rolesAuthorizedActions->contains($rolesAuthorizedAction)) {
  94.             $this->rolesAuthorizedActions[] = $rolesAuthorizedAction;
  95.             $rolesAuthorizedAction->setRole($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeRolesAuthorizedAction(RolesAuthorizedActions $rolesAuthorizedAction): self
  100.     {
  101.         if ($this->rolesAuthorizedActions->removeElement($rolesAuthorizedAction)) {
  102.             // set the owning side to null (unless already changed)
  103.             if ($rolesAuthorizedAction->getRole() === $this) {
  104.                 $rolesAuthorizedAction->setRole(null);
  105.             }
  106.         }
  107.         return $this;
  108.     }
  109.     public function isNotRemovable(): ?bool
  110.     {
  111.         return $this->notRemovable;
  112.     }
  113.     public function setNotRemovable(bool $notRemovable): self
  114.     {
  115.         $this->notRemovable $notRemovable;
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return Collection<int, UserEstablishment>
  120.      */
  121.     public function getUserEstablishments(): Collection
  122.     {
  123.         return $this->userEstablishments;
  124.     }
  125.     public function addUserEstablishment(UserEstablishment $userEstablishment): self
  126.     {
  127.         if (!$this->userEstablishments->contains($userEstablishment)) {
  128.             $this->userEstablishments[] = $userEstablishment;
  129.             $userEstablishment->setRole($this);
  130.         }
  131.         return $this;
  132.     }
  133.     public function removeUserEstablishment(UserEstablishment $userEstablishment): self
  134.     {
  135.         if ($this->userEstablishments->removeElement($userEstablishment)) {
  136.             // set the owning side to null (unless already changed)
  137.             if ($userEstablishment->getRole() === $this) {
  138.                 $userEstablishment->setRole(null);
  139.             }
  140.         }
  141.         return $this;
  142.     }
  143. }