src/Entity/BackendGroup.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\BackendGroupRepository")
  8.  */
  9. class BackendGroup
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private $groupName;
  21.     /**
  22.      * @ORM\Column(type="text", nullable=true)
  23.      */
  24.     private $description;
  25.     
  26.     /**
  27.     * @ORM\ManyToMany(targetEntity="App\Entity\User", mappedBy="backendGroups")
  28.     */
  29.     private $users;
  30.     /**
  31.      * @ORM\Column(type="integer", nullable=true)
  32.      */
  33.     private $createdBy;
  34.     /**
  35.      * @ORM\Column(type="array", nullable=true)
  36.      */
  37.     private $permission;
  38.     
  39.     public function __toString()
  40.     {
  41.         return $this->groupName;
  42.     }
  43.     public function __construct()
  44.     {
  45.         $this->users = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getGroupName(): ?string
  52.     {
  53.         return $this->groupName;
  54.     }
  55.     public function setGroupName(string $groupName): self
  56.     {
  57.         $this->groupName $groupName;
  58.         return $this;
  59.     }
  60.     public function getDescription(): ?string
  61.     {
  62.         return $this->description;
  63.     }
  64.     public function setDescription(?string $description): self
  65.     {
  66.         $this->description $description;
  67.         return $this;
  68.     }
  69.     /**
  70.      * @return Collection|User[]
  71.      */
  72.     public function getUsers(): Collection
  73.     {
  74.         return $this->users;
  75.     }
  76.     public function addUser(User $user): self
  77.     {
  78.         if (!$this->users->contains($user)) {
  79.             $this->users[] = $user;
  80.             $user->addBackendGroup($this);
  81.         }
  82.         return $this;
  83.     }
  84.     public function removeUser(User $user): self
  85.     {
  86.         if ($this->users->contains($user)) {
  87.             $this->users->removeElement($user);
  88.             $user->removeBackendGroup($this);
  89.         }
  90.         return $this;
  91.     }
  92.     public function getCreatedBy(): ?int
  93.     {
  94.         return $this->createdBy;
  95.     }
  96.     public function setCreatedBy(?int $createdBy): self
  97.     {
  98.         $this->createdBy $createdBy;
  99.         return $this;
  100.     }
  101.     public function getPermission(): ?array
  102.     {
  103.         return $this->permission;
  104.     }
  105.     public function setPermission(?array $permission): self
  106.     {
  107.         $this->permission $permission;
  108.         return $this;
  109.     }
  110. }