src/Entity/Role.php line 13
<?phpnamespace App\Entity;use App\Repository\RoleRepository;use App\Trait\ArrayableTrait;use App\Trait\DeletableTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: RoleRepository::class)]class Role{use DeletableTrait;use ArrayableTrait;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\ManyToOne(inversedBy: 'roleWorkers')]private ?Establishment $establishment = null;#[ORM\OneToMany(mappedBy: 'function', targetEntity: Employee::class)]private Collection $employees;public function __construct(){$this->employees = new ArrayCollection();}public function __toString(): string{return $this->name;}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(string $name): static{$this->name = $name;return $this;}public function getEstablishment(): ?Establishment{return $this->establishment;}public function setEstablishment(?Establishment $establishment): static{$this->establishment = $establishment;return $this;}/*** @return Collection<int, Employee>*/public function getEmployees(): Collection{return $this->employees;}public function addEmployee(Employee $employee): static{if (!$this->employees->contains($employee)) {$this->employees->add($employee);$employee->setFunction($this);}return $this;}public function removeEmployee(Employee $employee): static{if ($this->employees->removeElement($employee)) {// set the owning side to null (unless already changed)if ($employee->getFunction() === $this) {$employee->setFunction(null);}}return $this;}}