<?php
namespace App\Entity;
use App\Repository\RightRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=RightRepository::class)
* @ORM\Table(name="`right`")
*/
class Right
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $code;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $moduleCode;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $moduleName;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(name="module_order", type="integer", options={"default" : 0})
*/
private $moduleOrder = 0;
/**
* @ORM\ManyToMany(targetEntity=GroupUser::class, inversedBy="rights")
*/
private $groups;
public function __construct()
{
$this->groups = new ArrayCollection();
}
// --- Getters & Setters ---
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getModuleCode(): ?string
{
return $this->moduleCode;
}
public function setModuleCode(?string $moduleCode): self
{
$this->moduleCode = $moduleCode;
return $this;
}
public function getModuleName(): ?string
{
return $this->moduleName;
}
public function setModuleName(?string $moduleName): self
{
$this->moduleName = $moduleName;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getModuleOrder(): int
{
return $this->moduleOrder;
}
public function setModuleOrder(int $moduleOrder): self
{
$this->moduleOrder = $moduleOrder;
return $this;
}
/**
* @return Collection|GroupUser[]
*/
public function getGroups(): Collection
{
return $this->groups;
}
public function addGroup(GroupUser $group): self
{
if (!$this->groups->contains($group)) {
$this->groups[] = $group;
}
return $this;
}
public function removeGroup(GroupUser $group): self
{
$this->groups->removeElement($group);
return $this;
}
}