src/Entity/Region.php line 12
<?phpnamespace App\Entity;use App\Repository\RegionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;#[ORM\Entity(repositoryClass: RegionRepository::class)]class Region{use TimestampableEntity;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\OneToMany(mappedBy: 'region', targetEntity: User::class)]private Collection $users;#[ORM\OneToMany(mappedBy: 'region', targetEntity: UserRegion::class)]private Collection $userRegions;public function __construct(){$this->users = new ArrayCollection();$this->userRegions = new ArrayCollection();}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;}/*** @return Collection<int, User>*/public function getUsers(): Collection{return $this->users;}public function addUser(User $user): static{if (!$this->users->contains($user)) {$this->users->add($user);$user->setRegion($this);}return $this;}public function removeUser(User $user): static{if ($this->users->removeElement($user)) {// set the owning side to null (unless already changed)if ($user->getRegion() === $this) {$user->setRegion(null);}}return $this;}public function getUsersCount(){return $this->users->count();}// add to stringpublic function __toString(){return $this->name;}/*** @return Collection<int, UserRegion>*/public function getUserRegions(): Collection{return $this->userRegions;}public function addUserRegion(UserRegion $userRegion): static{if (!$this->userRegions->contains($userRegion)) {$this->userRegions->add($userRegion);$userRegion->setRegion($this);}return $this;}public function removeUserRegion(UserRegion $userRegion): static{if ($this->userRegions->removeElement($userRegion)) {// set the owning side to null (unless already changed)if ($userRegion->getRegion() === $this) {$userRegion->setRegion(null);}}return $this;}}