src/Entity/Destination.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DestinationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass=DestinationRepository::class)
  10.  */
  11. class Destination
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $name;
  23.     /**
  24.      * Slug immuable et unique (ex: "st-lucie")
  25.      * @Gedmo\Slug(fields={"name"}, updatable=true, unique=true)
  26.      * @ORM\Column(type="string", length=180, unique=true)
  27.      */
  28.     private $slug;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      */
  32.     private $description;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      */
  36.     private $img;
  37.     /**
  38.      * @ORM\OneToMany(targetEntity=Hebergement::class, mappedBy="country")
  39.      */
  40.     private $hebergements;
  41.     /**
  42.      * @ORM\OneToMany(targetEntity=Offer::class, mappedBy="destination")
  43.      */
  44.     private $offers;
  45.     public function __construct()
  46.     {
  47.         $this->hebergements = new ArrayCollection();
  48.         $this->offers = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     /**
  55.      * Get the value of name
  56.      */ 
  57.     public function getName()
  58.     {
  59.         return $this->name;
  60.     }
  61.     /**
  62.      * Set the value of name
  63.      *
  64.      * @return  self
  65.      */ 
  66.     public function setName($name)
  67.     {
  68.         $this->name $name;
  69.         return $this;
  70.     }
  71.   
  72.     public function getDescription(): ?string
  73.     {
  74.         return $this->description;
  75.     }
  76.     public function setDescription(?string $description): self
  77.     {
  78.         $this->description $description;
  79.         return $this;
  80.     }
  81.     public function getImg(): ?string
  82.     {
  83.         return $this->img;
  84.     }
  85.     public function setImg(?string $img): self
  86.     {
  87.         $this->img $img;
  88.         return $this;
  89.     }
  90.     /**
  91.      * @return Collection<int, Hebergement>
  92.      */
  93.     public function getHebergements(): Collection
  94.     {
  95.         return $this->hebergements;
  96.     }
  97.     public function addHebergement(Hebergement $hebergement): self
  98.     {
  99.         if (!$this->hebergements->contains($hebergement)) {
  100.             $this->hebergements[] = $hebergement;
  101.             $hebergement->setCountry($this);
  102.         }
  103.         return $this;
  104.     }
  105.     public function removeHebergement(Hebergement $hebergement): self
  106.     {
  107.         if ($this->hebergements->removeElement($hebergement)) {
  108.             // set the owning side to null (unless already changed)
  109.             if ($hebergement->getCountry() === $this) {
  110.                 $hebergement->setCountry(null);
  111.             }
  112.         }
  113.         return $this;
  114.     }
  115.     /**
  116.      * @return Collection<int, Offer>
  117.      */
  118.     public function getOffers(): Collection
  119.     {
  120.         return $this->offers;
  121.     }
  122.     public function addOffer(Offer $offer): self
  123.     {
  124.         if (!$this->offers->contains($offer)) {
  125.             $this->offers[] = $offer;
  126.             $offer->setDestination($this);
  127.         }
  128.         return $this;
  129.     }
  130.     public function removeOffer(Offer $offer): self
  131.     {
  132.         if ($this->offers->removeElement($offer)) {
  133.             // set the owning side to null (unless already changed)
  134.             if ($offer->getDestination() === $this) {
  135.                 $offer->setDestination(null);
  136.             }
  137.         }
  138.         return $this;
  139.     }
  140.     /**
  141.      * Get slug immuable et unique (ex: "st-lucie")
  142.      */ 
  143.     public function getSlug()
  144.     {
  145.         return $this->slug;
  146.     }
  147.     /**
  148.      * Set slug immuable et unique (ex: "st-lucie")
  149.      *
  150.      * @return  self
  151.      */ 
  152.     public function setSlug($slug)
  153.     {
  154.         $this->slug $slug;
  155.         return $this;
  156.     }
  157. }