src/Entity/Slave/Permission.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")
  9.  * @ORM\Entity
  10.  */
  11. class Permission
  12. {     
  13.     public function __toString(){
  14.         return $this->getValue();
  15.     }
  16.        
  17.     /**
  18.      * @ORM\Column(name="id", type="bigint")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     protected $id;
  23.     /**
  24.      * @ORM\Column(name="slug", type="string", length=191, unique=true)
  25.      */
  26.     protected $slug;
  27.     
  28.     /**
  29.      * @ORM\Column(name="value", type="string", length=191)
  30.      */
  31.     protected $value;
  32.     
  33.     /**
  34.      * @ORM\Column(name="priority", type="integer")
  35.      */
  36.     protected $priority;
  37.     // ManyToOne
  38.         /**
  39.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\PermissionCategory", inversedBy="permissions")
  40.          * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
  41.          */
  42.         private $category;
  43.     //
  44.     // OneToMany
  45.         /**
  46.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\JoinTableAccountTypePermission", mappedBy="permission")
  47.          */
  48.         private $accountTypes;
  49.         public function __construct()
  50.         {
  51.             $this->accountTypes = new ArrayCollection();
  52.         }
  53.     //
  54.     public function getId(): ?string
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getSlug(): ?string
  59.     {
  60.         return $this->slug;
  61.     }
  62.     public function setSlug(string $slug): self
  63.     {
  64.         $this->slug $slug;
  65.         return $this;
  66.     }
  67.     public function getValue(): ?string
  68.     {
  69.         return $this->value;
  70.     }
  71.     public function setValue(string $value): self
  72.     {
  73.         $this->value $value;
  74.         return $this;
  75.     }
  76.     public function getPriority(): ?int
  77.     {
  78.         return $this->priority;
  79.     }
  80.     public function setPriority(int $priority): self
  81.     {
  82.         $this->priority $priority;
  83.         return $this;
  84.     }
  85.     public function getCategory(): ?PermissionCategory
  86.     {
  87.         return $this->category;
  88.     }
  89.     public function setCategory(?PermissionCategory $category): self
  90.     {
  91.         $this->category $category;
  92.         return $this;
  93.     }
  94.     /**
  95.      * @return Collection<int, JoinTableAccountTypePermission>
  96.      */
  97.     public function getAccountTypes(): Collection
  98.     {
  99.         return $this->accountTypes;
  100.     }
  101.     public function addAccountType(JoinTableAccountTypePermission $accountType): self
  102.     {
  103.         if (!$this->accountTypes->contains($accountType)) {
  104.             $this->accountTypes->add($accountType);
  105.             $accountType->setPermission($this);
  106.         }
  107.         return $this;
  108.     }
  109.     public function removeAccountType(JoinTableAccountTypePermission $accountType): self
  110.     {
  111.         if ($this->accountTypes->removeElement($accountType)) {
  112.             // set the owning side to null (unless already changed)
  113.             if ($accountType->getPermission() === $this) {
  114.                 $accountType->setPermission(null);
  115.             }
  116.         }
  117.         return $this;
  118.     }
  119. }