src/Entity/Localisation.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LocalisationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassLocalisationRepository::class)]
  8. class Localisation
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length50nullabletrue)]
  15.     private $region;
  16.     #[ORM\Column(type'string'length50nullabletrue)]
  17.     private $ville;
  18.     #[ORM\OneToMany(mappedBy'localisation'targetEntityMissions::class)]
  19.     private $missions;
  20.     public function __construct()
  21.     {
  22.         $this->missions = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getRegion(): ?string
  29.     {
  30.         return $this->region;
  31.     }
  32.     public function setRegion(string $region): self
  33.     {
  34.         $this->region $region;
  35.         return $this;
  36.     }
  37.     public function getVille(): ?string
  38.     {
  39.         return $this->ville;
  40.     }
  41.     public function setVille(string $ville): self
  42.     {
  43.         $this->ville $ville;
  44.         return $this;
  45.     }
  46.     /**
  47.      * @return Collection<int, Missions>
  48.      */
  49.     public function getMissions(): Collection
  50.     {
  51.         return $this->missions;
  52.     }
  53.     public function addMission(Missions $mission): self
  54.     {
  55.         if (!$this->missions->contains($mission)) {
  56.             $this->missions[] = $mission;
  57.             $mission->setLocalisation($this);
  58.         }
  59.         return $this;
  60.     }
  61.     public function removeMission(Missions $mission): self
  62.     {
  63.         if ($this->missions->removeElement($mission)) {
  64.             // set the owning side to null (unless already changed)
  65.             if ($mission->getLocalisation() === $this) {
  66.                 $mission->setLocalisation(null);
  67.             }
  68.         }
  69.         return $this;
  70.     }
  71. }