<?phpnamespace App\Entity\Security;use App\Entity\User\User;use App\Repository\Security\ProfileRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=ProfileRepository::class) */class Profile{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\OneToMany(targetEntity=Permission::class, mappedBy="profile", orphanRemoval=true) */ private $permissions; /** * @ORM\OneToMany(targetEntity=User::class, mappedBy="profile") */ private $users; public function __construct() { $this->permissions = new ArrayCollection(); $this->users = new ArrayCollection(); } 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; } /** * @return Collection<int, Permission> */ public function getPermissions(): Collection { return $this->permissions; } public function addPermission(Permission $permission): self { if (!$this->permissions->contains($permission)) { $this->permissions[] = $permission; $permission->setProfile($this); } return $this; } public function removePermission(Permission $permission): self { if ($this->permissions->removeElement($permission)) { // set the owning side to null (unless already changed) if ($permission->getProfile() === $this) { $permission->setProfile(null); } } return $this; } public function __toString(): string { return $this->name; } /** * @return Collection<int, User> */ public function getUsers(): Collection { return $this->users; } public function addUser(User $user): self { if (!$this->users->contains($user)) { $this->users[] = $user; $user->setProfile($this); } return $this; } public function removeUser(User $user): self { if ($this->users->removeElement($user)) { // set the owning side to null (unless already changed) if ($user->getProfile() === $this) { $user->setProfile(null); } } return $this; }}