<?phpdeclare(strict_types=1);namespace App\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * Region. * * @ORM\Table(name="Region") * * @ORM\Entity() */class Region{ /** * @var int * * @ORM\Column(name="id", type="integer") * * @ORM\Id * * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="nom", type="string", length=255) */ private $nom; /** * @ORM\OneToMany(targetEntity="Departement", mappedBy="region") */ private $departements; /** * @ORM\OneToMany(targetEntity="User", mappedBy="region") */ private $users; /** * @ORM\OneToMany(targetEntity="Structure", mappedBy="region") */ private $structures; /** * @ORM\ManyToOne(targetEntity="GrandeRegion", inversedBy="regions") * * @ORM\JoinColumn(name="grandeRegion_id", referencedColumnName="id") */ private $grandeRegion; /** * Constructor. */ public function __construct() { $this->departements = new \Doctrine\Common\Collections\ArrayCollection(); $this->users = new ArrayCollection(); $this->structures = new ArrayCollection(); } /** * Methode pour afficher la region. */ #[\Override] public function __toString(): string { return $this->getNom(); } /** * Get id. * * @return int */ public function getId() { return $this->id; } /** * Set nom. * * @param string $nom */ public function setNom($nom): static { $this->nom = $nom; return $this; } /** * Get nom. * * @return string */ public function getNom() { return $this->nom; } /** * Add departements. */ public function addDepartement(Departement $departements): static { $this->departements[] = $departements; return $this; } /** * Remove departements. */ public function removeDepartement(Departement $departements): void { $this->departements->removeElement($departements); } /** * Get departements. * * @return Collection */ public function getDepartements() { return $this->departements; } /** * Add users. */ public function addUser(User $user): static { if (!$this->users->contains($user)) { $this->users[] = $user; $user->setRegion($this); } return $this; } /** * Remove users. */ public function removeUser(User $user): void { // set the owning side to null (unless already changed) if ($this->users->removeElement($user) && $user->setRegion() === $this) { $user->setRegion(null); } } /** * Get users. * * @return Collection */ public function getUsers() { return $this->users; } /** * Add structures. */ public function addStructure(Structure $structures): static { $this->structures[] = $structures; return $this; } /** * Remove structures. */ public function removeStructure(Structure $structures): void { $this->structures->removeElement($structures); } /** * Get structures. * * @return Collection */ public function getStructures() { return $this->structures; } /** * Set grandeRegion. */ public function setGrandeRegion(?GrandeRegion $grandeRegion = null): static { $this->grandeRegion = $grandeRegion; return $this; } /** * Get grandeRegion. * * @return GrandeRegion */ public function getGrandeRegion() { return $this->grandeRegion; }}