src/Entity/Continent.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ContinentRepository;
  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=ContinentRepository::class)
  10.  */
  11. class Continent
  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, nullable=true)
  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 $img;
  33.     /**
  34.      * @ORM\OneToMany(targetEntity=Offer::class, mappedBy="continent")
  35.      */
  36.     private $offers;
  37.     /**
  38.      * @ORM\Column(type="string", length=255, nullable=true)
  39.      */
  40.     private $subtitle;
  41.     public function __construct()
  42.     {
  43.         $this->offers = new ArrayCollection();
  44.     }
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getName(): ?string
  50.     {
  51.         return $this->name;
  52.     }
  53.     public function setName(?string $name): self
  54.     {
  55.         $this->name $name;
  56.         return $this;
  57.     }
  58.     public function getImg(): ?string
  59.     {
  60.         return $this->img;
  61.     }
  62.     public function setImg(?string $img): self
  63.     {
  64.         $this->img $img;
  65.         return $this;
  66.     }
  67.     /**
  68.      * @return Collection<int, Offer>
  69.      */
  70.     public function getOffers(): Collection
  71.     {
  72.         return $this->offers;
  73.     }
  74.     public function addOffer(Offer $offer): self
  75.     {
  76.         if (!$this->offers->contains($offer)) {
  77.             $this->offers[] = $offer;
  78.             $offer->setContinent($this);
  79.         }
  80.         return $this;
  81.     }
  82.     public function removeOffer(Offer $offer): self
  83.     {
  84.         if ($this->offers->removeElement($offer)) {
  85.             // set the owning side to null (unless already changed)
  86.             if ($offer->getContinent() === $this) {
  87.                 $offer->setContinent(null);
  88.             }
  89.         }
  90.         return $this;
  91.     }
  92.     /**
  93.      * Get slug immuable et unique (ex: "st-lucie")
  94.      */ 
  95.     public function getSlug()
  96.     {
  97.         return $this->slug;
  98.     }
  99.     /**
  100.      * Set slug immuable et unique (ex: "st-lucie")
  101.      *
  102.      * @return  self
  103.      */ 
  104.     public function setSlug($slug)
  105.     {
  106.         $this->slug $slug;
  107.         return $this;
  108.     }
  109.     public function getSubtitle(): ?string
  110.     {
  111.         return $this->subtitle;
  112.     }
  113.     public function setSubtitle(?string $subtitle): self
  114.     {
  115.         $this->subtitle $subtitle;
  116.         return $this;
  117.     }
  118. }