src/Entity/Quartier.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\QuartierRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=QuartierRepository::class)
  9.  */
  10. class Quartier
  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)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity=User::class, mappedBy="quartier")
  24.      */
  25.     private $users;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=Ville::class, inversedBy="quartiers")
  28.      * @ORM\JoinColumn(nullable=false)
  29.      */
  30.     private $ville;
  31.     /**
  32.      * @ORM\Column(type="float", nullable=true)
  33.      */
  34.     private $logitude;
  35.     /**
  36.      * @ORM\Column(type="float", nullable=true)
  37.      */
  38.     private $latitude;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=IctusPharmacie::class, mappedBy="quartier")
  41.      */
  42.     private $ictusPharmacies;
  43.     /**
  44.      * @ORM\OneToMany(targetEntity=Adresse::class, mappedBy="quartier")
  45.      */
  46.     private $adresses;
  47.     /**
  48.      * @ORM\OneToMany(targetEntity=Zone::class, mappedBy="quartier")
  49.      */
  50.     private $zones;
  51.     /**
  52.      * @ORM\ManyToMany(targetEntity=ZoneQuartier::class, mappedBy="quartier")
  53.      */
  54.     private $zoneQuartiers;
  55.  
  56.     public function __construct()
  57.     {
  58.         $this->users = new ArrayCollection();
  59.         $this->ictusPharmacies = new ArrayCollection();
  60.         $this->adresses = new ArrayCollection();
  61.         $this->zones = new ArrayCollection();
  62.         $this->zoneQuartiers = new ArrayCollection();
  63.     }
  64.     public function __toString(){
  65.         return $this->getName();
  66.     }
  67.     public function getId(): ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getName(): ?string
  72.     {
  73.         return $this->name;
  74.     }
  75.     public function setName(string $name): self
  76.     {
  77.         $this->name $name;
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection<int, User>
  82.      */
  83.     public function getUsers(): Collection
  84.     {
  85.         return $this->users;
  86.     }
  87.     public function addUser(User $user): self
  88.     {
  89.         if (!$this->users->contains($user)) {
  90.             $this->users[] = $user;
  91.             $user->setQuartier($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeUser(User $user): self
  96.     {
  97.         if ($this->users->removeElement($user)) {
  98.             // set the owning side to null (unless already changed)
  99.             if ($user->getQuartier() === $this) {
  100.                 $user->setQuartier(null);
  101.             }
  102.         }
  103.         return $this;
  104.     }
  105.     public function getVille(): ?Ville
  106.     {
  107.         return $this->ville;
  108.     }
  109.     public function setVille(?Ville $ville): self
  110.     {
  111.         $this->ville $ville;
  112.         return $this;
  113.     }
  114.     public function getLogitude(): ?float
  115.     {
  116.         return $this->logitude;
  117.     }
  118.     public function setLogitude(?float $logitude): self
  119.     {
  120.         $this->logitude $logitude;
  121.         return $this;
  122.     }
  123.     public function getLatitude(): ?float
  124.     {
  125.         return $this->latitude;
  126.     }
  127.     public function setLatitude(?float $latitude): self
  128.     {
  129.         $this->latitude $latitude;
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return Collection<int, IctusPharmacie>
  134.      */
  135.     public function getIctusPharmacies(): Collection
  136.     {
  137.         return $this->ictusPharmacies;
  138.     }
  139.     public function addIctusPharmacy(IctusPharmacie $ictusPharmacy): self
  140.     {
  141.         if (!$this->ictusPharmacies->contains($ictusPharmacy)) {
  142.             $this->ictusPharmacies[] = $ictusPharmacy;
  143.             $ictusPharmacy->setQuartier($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removeIctusPharmacy(IctusPharmacie $ictusPharmacy): self
  148.     {
  149.         if ($this->ictusPharmacies->removeElement($ictusPharmacy)) {
  150.             // set the owning side to null (unless already changed)
  151.             if ($ictusPharmacy->getQuartier() === $this) {
  152.                 $ictusPharmacy->setQuartier(null);
  153.             }
  154.         }
  155.         return $this;
  156.     }
  157.     /**
  158.      * @return Collection<int, Adresse>
  159.      */
  160.     public function getAdresses(): Collection
  161.     {
  162.         return $this->adresses;
  163.     }
  164.     public function addAdress(Adresse $adress): self
  165.     {
  166.         if (!$this->adresses->contains($adress)) {
  167.             $this->adresses[] = $adress;
  168.             $adress->setQuartier($this);
  169.         }
  170.         return $this;
  171.     }
  172.     public function removeAdress(Adresse $adress): self
  173.     {
  174.         if ($this->adresses->removeElement($adress)) {
  175.             // set the owning side to null (unless already changed)
  176.             if ($adress->getQuartier() === $this) {
  177.                 $adress->setQuartier(null);
  178.             }
  179.         }
  180.         return $this;
  181.     }
  182.     /**
  183.      * @return Collection<int, Zone>
  184.      */
  185.     public function getZones(): Collection
  186.     {
  187.         return $this->zones;
  188.     }
  189.     public function addZone(Zone $zone): self
  190.     {
  191.         if (!$this->zones->contains($zone)) {
  192.             $this->zones[] = $zone;
  193.             $zone->setQuartier($this);
  194.         }
  195.         return $this;
  196.     }
  197.     public function removeZone(Zone $zone): self
  198.     {
  199.         if ($this->zones->removeElement($zone)) {
  200.             // set the owning side to null (unless already changed)
  201.             if ($zone->getQuartier() === $this) {
  202.                 $zone->setQuartier(null);
  203.             }
  204.         }
  205.         return $this;
  206.     }
  207.     /**
  208.      * @return Collection<int, ZoneQuartier>
  209.      */
  210.     public function getZoneQuartiers(): Collection
  211.     {
  212.         return $this->zoneQuartiers;
  213.     }
  214.     public function addZoneQuartier(ZoneQuartier $zoneQuartier): self
  215.     {
  216.         if (!$this->zoneQuartiers->contains($zoneQuartier)) {
  217.             $this->zoneQuartiers[] = $zoneQuartier;
  218.             $zoneQuartier->addQuartier($this);
  219.         }
  220.         return $this;
  221.     }
  222.     public function removeZoneQuartier(ZoneQuartier $zoneQuartier): self
  223.     {
  224.         if ($this->zoneQuartiers->removeElement($zoneQuartier)) {
  225.             $zoneQuartier->removeQuartier($this);
  226.         }
  227.         return $this;
  228.     }
  229.     
  230.  
  231. }