src/Entity/Slave/PermissionCategory.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Slave;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="eposm_s_permission_category")
  9.  * @ORM\Entity
  10.  */
  11. class PermissionCategory
  12. {        
  13.     /**
  14.      * @ORM\Column(name="id", type="bigint")
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue(strategy="AUTO")
  17.      */
  18.     protected $id;
  19.     
  20.     /**
  21.      * @ORM\Column(name="value", type="string", length=191)
  22.      */
  23.     protected $value;
  24.     // OneToMany
  25.         /**
  26.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\Permission", mappedBy="category")
  27.          */
  28.         private $permissions;
  29.     //
  30.     public function __construct()
  31.     {
  32.         $this->permissions = new ArrayCollection();
  33.     }
  34.     public function getId(): ?string
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getValue(): ?string
  39.     {
  40.         return $this->value;
  41.     }
  42.     public function setValue(string $value): self
  43.     {
  44.         $this->value $value;
  45.         return $this;
  46.     }
  47.     /**
  48.      * @return Collection<int, Permission>
  49.      */
  50.     public function getPermissions(): Collection
  51.     {
  52.         return $this->permissions;
  53.     }
  54.     public function addPermission(Permission $permission): self
  55.     {
  56.         if (!$this->permissions->contains($permission)) {
  57.             $this->permissions->add($permission);
  58.             $permission->setCategory($this);
  59.         }
  60.         return $this;
  61.     }
  62.     public function removePermission(Permission $permission): self
  63.     {
  64.         if ($this->permissions->removeElement($permission)) {
  65.             // set the owning side to null (unless already changed)
  66.             if ($permission->getCategory() === $this) {
  67.                 $permission->setCategory(null);
  68.             }
  69.         }
  70.         return $this;
  71.     }
  72. }