src/Entity/Themes.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ThemesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ThemesRepository::class)
  9.  */
  10. class Themes
  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\Column(type="boolean")
  24.      */
  25.     private $etat;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=Sejour::class, mappedBy="themes")
  28.      */
  29.     private $sejours;
  30.     /**
  31.      * @ORM\ManyToMany(targetEntity=Hotel::class, mappedBy="hotelthemes")
  32.      */
  33.     private $hotels;
  34.     public function __construct()
  35.     {
  36.         $this->sejours = new ArrayCollection();
  37.         $this->hotels = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(string $name): self
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     public function isEtat(): ?bool
  53.     {
  54.         return $this->etat;
  55.     }
  56.     public function setEtat(bool $etat): self
  57.     {
  58.         $this->etat $etat;
  59.         return $this;
  60.     }
  61.     /**
  62.      * @return Collection<int, Sejour>
  63.      */
  64.     public function getSejours(): Collection
  65.     {
  66.         return $this->sejours;
  67.     }
  68.     public function addSejour(Sejour $sejour): self
  69.     {
  70.         if (!$this->sejours->contains($sejour)) {
  71.             $this->sejours[] = $sejour;
  72.             $sejour->setThemes($this);
  73.         }
  74.         return $this;
  75.     }
  76.     public function removeSejour(Sejour $sejour): self
  77.     {
  78.         if ($this->sejours->removeElement($sejour)) {
  79.             // set the owning side to null (unless already changed)
  80.             if ($sejour->getThemes() === $this) {
  81.                 $sejour->setThemes(null);
  82.             }
  83.         }
  84.         return $this;
  85.     }
  86.     public function __toString()
  87.     {
  88.         return $this->name;
  89.     }
  90.     /**
  91.      * @return Collection<int, Hotel>
  92.      */
  93.     public function getHotels(): Collection
  94.     {
  95.         return $this->hotels;
  96.     }
  97.     public function addHotel(Hotel $hotel): self
  98.     {
  99.         if (!$this->hotels->contains($hotel)) {
  100.             $this->hotels[] = $hotel;
  101.             $hotel->addHoteltheme($this);
  102.         }
  103.         return $this;
  104.     }
  105.     public function removeHotel(Hotel $hotel): self
  106.     {
  107.         if ($this->hotels->removeElement($hotel)) {
  108.             $hotel->removeHoteltheme($this);
  109.         }
  110.         return $this;
  111.     }
  112. }