src/Entity/Villes.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\VillesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=VillesRepository::class)
  9.  */
  10. class Villes
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255, nullable=true)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="boolean", nullable=true)
  24.      */
  25.     private $etat;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Pays::class, inversedBy="villes")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $pays;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=Hotel::class, mappedBy="villes", orphanRemoval=true)
  33.      */
  34.     private $hotels;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=Coordonnescircuit::class, mappedBy="ville", orphanRemoval=true)
  37.      */
  38.     private $coordonnescircuits;
  39.     public function __construct()
  40.     {
  41.         $this->hotels = new ArrayCollection();
  42.         $this->coordonnescircuits = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getName(): ?string
  49.     {
  50.         return $this->name;
  51.     }
  52.     public function setName(?string $name): self
  53.     {
  54.         $this->name $name;
  55.         return $this;
  56.     }
  57.     public function isEtat(): ?bool
  58.     {
  59.         return $this->etat;
  60.     }
  61.     public function setEtat(?bool $etat): self
  62.     {
  63.         $this->etat $etat;
  64.         return $this;
  65.     }
  66.     public function getPays(): ?Pays
  67.     {
  68.         return $this->pays;
  69.     }
  70.     public function setPays(?Pays $pays): self
  71.     {
  72.         $this->pays $pays;
  73.         return $this;
  74.     }
  75.     /**
  76.      * @return Collection<int, Hotel>
  77.      */
  78.     public function getHotels(): Collection
  79.     {
  80.         return $this->hotels;
  81.     }
  82.     public function addHotel(Hotel $hotel): self
  83.     {
  84.         if (!$this->hotels->contains($hotel)) {
  85.             $this->hotels[] = $hotel;
  86.             $hotel->setVilles($this);
  87.         }
  88.         return $this;
  89.     }
  90.     public function removeHotel(Hotel $hotel): self
  91.     {
  92.         if ($this->hotels->removeElement($hotel)) {
  93.             // set the owning side to null (unless already changed)
  94.             if ($hotel->getVilles() === $this) {
  95.                 $hotel->setVilles(null);
  96.             }
  97.         }
  98.         return $this;
  99.     }
  100.     public function __toString()
  101.     {
  102.         return $this->name;
  103.     }
  104.     /**
  105.      * @return Collection<int, Coordonnescircuit>
  106.      */
  107.     public function getCoordonnescircuits(): Collection
  108.     {
  109.         return $this->coordonnescircuits;
  110.     }
  111.     public function addCoordonnescircuit(Coordonnescircuit $coordonnescircuit): self
  112.     {
  113.         if (!$this->coordonnescircuits->contains($coordonnescircuit)) {
  114.             $this->coordonnescircuits[] = $coordonnescircuit;
  115.             $coordonnescircuit->setVille($this);
  116.         }
  117.         return $this;
  118.     }
  119.     public function removeCoordonnescircuit(Coordonnescircuit $coordonnescircuit): self
  120.     {
  121.         if ($this->coordonnescircuits->removeElement($coordonnescircuit)) {
  122.             // set the owning side to null (unless already changed)
  123.             if ($coordonnescircuit->getVille() === $this) {
  124.                 $coordonnescircuit->setVille(null);
  125.             }
  126.         }
  127.         return $this;
  128.     }
  129. }