<?php
namespace App\Entity;
use App\Repository\LocalisationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: LocalisationRepository::class)]
class Localisation
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private $region;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private $ville;
#[ORM\OneToMany(mappedBy: 'localisation', targetEntity: Missions::class)]
private $missions;
public function __construct()
{
$this->missions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getRegion(): ?string
{
return $this->region;
}
public function setRegion(string $region): self
{
$this->region = $region;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(string $ville): self
{
$this->ville = $ville;
return $this;
}
/**
* @return Collection<int, Missions>
*/
public function getMissions(): Collection
{
return $this->missions;
}
public function addMission(Missions $mission): self
{
if (!$this->missions->contains($mission)) {
$this->missions[] = $mission;
$mission->setLocalisation($this);
}
return $this;
}
public function removeMission(Missions $mission): self
{
if ($this->missions->removeElement($mission)) {
// set the owning side to null (unless already changed)
if ($mission->getLocalisation() === $this) {
$mission->setLocalisation(null);
}
}
return $this;
}
}