<?phpnamespace App\Entity;use App\Repository\LocalisationRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use phpDocumentor\Reflection\Types\Integer;#[ORM\Entity(repositoryClass: LocalisationRepository::class)]class Localisation{ //Déclarations de variables #[ORM\Id] #[ORM\Column(name: 'id_localisation',type: 'integer', nullable: false)] //Spécifie que la valeur générée est un ID auto-incrémenté #[ORM\GeneratedValue(strategy:'IDENTITY')] private ?int $id; #[ORM\Column(length:255,nullable:true)] private ?string $ville = null; #[ORM\Column(length:255,nullable:true)] private ?string $departement = null; #[ORM\Column(length:255,nullable:true)] private ?string $region = null; #[ORM\Column(length:255,nullable:true)] private ?string $pays = null; //Associations #[ORM\OneToMany(mappedBy:'localisation', targetEntity: Model::class, orphanRemoval: true)] private ?Collection $models; //Constructeur public function __construct() { $this->models = new ArrayCollection(); } //Getters et Setters //Fonctions des variables /** * @return int|null */ public function getId(): ?int { return $this->id; } /** * @return string|null */ public function getVille(): ?string { return $this->ville; } /** * @param string|null $ville */ public function setVille(?string $ville): void { $this->ville = $ville; } /** * @return string|null */ public function getDepartement(): ?string { return $this->departement; } /** * @param string|null $departement */ public function setDepartement(?string $departement): void { $this->departement = $departement; } /** * @return string|null */ public function getRegion(): ?string { return $this->region; } /** * @param string|null $region */ public function setRegion(?string $region): void { $this->region = $region; } /** * @return string|null */ public function getPays(): ?string { return $this->pays; } /** * @param string|null $pays */ public function setPays(?string $pays): void { $this->pays = $pays; } //Fonction des collections /** * @return Collection<int, Model> */ public function getModels(): Collection { return $this->models; } public function addModel(Model $model): self { if (!$this->models->contains($model)) { $this->models->add($model); $model->addLocalisation($this); } return $this; } public function removeModel(Model $model): self { if ($this->models->removeElement($model)) { // set the owning side to null (unless already changed) if ($model->getLocalisation() === $this) { $model->addLocalisation(null); } } return $this; } public function __toString(): string { return $this->ville; }}