src/Entity/System/roles.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use App\Repository\System\rolesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassrolesRepository::class)]
  8. class roles
  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'text'nullabletrue)]
  17.     private $description;
  18.     #[ORM\Column(type'datetime'nullabletrue)]
  19.     private $created_at;
  20.     #[ORM\Column(type'datetime'nullabletrue)]
  21.     private $updated_at;
  22.     #[ORM\OneToMany(mappedBy'roles'targetEntitypermissions::class)]
  23.     private $permissions;
  24.     #[ORM\OneToMany(mappedBy'roles'targetEntityaccess::class)]
  25.     private $accesses;
  26.     #[ORM\OneToMany(mappedBy'roles'targetEntityusersRoles::class)]
  27.     private $usersRoles;
  28.     public function __construct()
  29.     {
  30.         $this->permissions = new ArrayCollection();
  31.         $this->accesses = new ArrayCollection();
  32.         $this->usersRoles = new ArrayCollection();
  33.     }
  34.     public function setId(?int $id): self
  35.     {
  36.         $this->id $id;
  37.         return $this;
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(?string $name): self
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     public function getDescription(): ?string
  53.     {
  54.         return $this->description;
  55.     }
  56.     public function setDescription(?string $description): self
  57.     {
  58.         $this->description $description;
  59.         return $this;
  60.     }
  61.    
  62.     public function getCreatedAt(): ?\DateTimeInterface
  63.     {
  64.         return $this->created_at;
  65.     }
  66.     public function setCreatedAt(?\DateTimeInterface $created_at): self
  67.     {
  68.         $this->created_at $created_at;
  69.         return $this;
  70.     }
  71.     public function getUpdatedAt(): ?\DateTimeInterface
  72.     {
  73.         return $this->updated_at;
  74.     }
  75.     public function setUpdatedAt(?\DateTimeInterface $updated_at): self
  76.     {
  77.         $this->updated_at $updated_at;
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection<int, permissions>
  82.      */
  83.     public function getPermissions(): Collection
  84.     {
  85.         return $this->permissions;
  86.     }
  87.     public function addPermission(permissions $permission): self
  88.     {
  89.         if (!$this->permissions->contains($permission)) {
  90.             $this->permissions[] = $permission;
  91.             $permission->setRolesId($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removePermission(permissions $permission): self
  96.     {
  97.         if ($this->permissions->removeElement($permission)) {
  98.             // set the owning side to null (unless already changed)
  99.             if ($permission->getRolesId() === $this) {
  100.                 $permission->setRolesId(null);
  101.             }
  102.         }
  103.         return $this;
  104.     }
  105.     /**
  106.      * @return Collection<int, access>
  107.      */
  108.     public function getAccesses(): Collection
  109.     {
  110.         return $this->accesses;
  111.     }
  112.     public function addAccess(access $access): self
  113.     {
  114.         if (!$this->accesses->contains($access)) {
  115.             $this->accesses[] = $access;
  116.             $access->setRolesId($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removeAccess(access $access): self
  121.     {
  122.         if ($this->accesses->removeElement($access)) {
  123.             // set the owning side to null (unless already changed)
  124.             if ($access->getRolesId() === $this) {
  125.                 $access->setRolesId(null);
  126.             }
  127.         }
  128.         return $this;
  129.     }
  130.     /**
  131.      * @return Collection<int, usersRoles>
  132.      */
  133.     public function getUsersRoles(): Collection
  134.     {
  135.         return $this->usersRoles;
  136.     }
  137.     public function addUsersRole(usersRoles $usersRole): self
  138.     {
  139.         if (!$this->usersRoles->contains($usersRole)) {
  140.             $this->usersRoles[] = $usersRole;
  141.             $usersRole->setRolesId($this);
  142.         }
  143.         return $this;
  144.     }
  145.     public function removeUsersRole(usersRoles $usersRole): self
  146.     {
  147.         if ($this->usersRoles->removeElement($usersRole)) {
  148.             // set the owning side to null (unless already changed)
  149.             if ($usersRole->getRolesId() === $this) {
  150.                 $usersRole->setRolesId(null);
  151.             }
  152.         }
  153.         return $this;
  154.     }
  155. }