<?phpnamespace App\Entity;use App\Repository\UserPositionsRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;/** * @ORM\Entity(repositoryClass=UserPositionsRepository::class) */class UserPositions{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") * @Groups({"user.position.core"}) */ private $id; /** * @ORM\Column(type="string", length=64) * @Groups({"user.position.core"}) */ private $name; /** * @ORM\OneToMany(targetEntity=UserPositionsGroup::class, mappedBy="user_position") */ private $groups; /** * @ORM\OneToMany(targetEntity=User::class, mappedBy="user_position") */ private $users; public function __construct() { $this->groups = 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, UserPositionsGroup> */ public function getGroups(): Collection { return $this->groups; } public function addUserPositionsGroup(UserPositionsGroup $userPositionsGroup): self { if (!$this->groups->contains($userPositionsGroup)) { $this->groups[] = $userPositionsGroup; $userPositionsGroup->setUserPosition($this); } return $this; } public function removeUserPositionsGroup(UserPositionsGroup $userPositionsGroup): self { if ($this->groups->removeElement($userPositionsGroup)) { // set the owning side to null (unless already changed) if ($userPositionsGroup->getUserPosition() === $this) { $userPositionsGroup->setUserPosition(null); } } return $this; } /** * @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->setUserPosition($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->getUserPosition() === $this) { $user->setUserPosition(null); } } return $this; }}