src/Entity/Avantage.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AvantageRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=AvantageRepository::class)
  9.  */
  10. class Avantage
  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="text", nullable=true)
  24.      */
  25.     private $description;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=Imagesavantage::class, mappedBy="avantages", orphanRemoval=true, cascade={"persist"})
  28.      */
  29.     private $imagesavantages;
  30.     /**
  31.      * @ORM\Column(type="boolean", nullable=true)
  32.      */
  33.     private $etat;
  34.     /**
  35.      * @ORM\ManyToMany(targetEntity=Souscroisiere::class, inversedBy="avantages")
  36.      */
  37.     private $souscroisiere;
  38.     public function __construct()
  39.     {
  40.         $this->imagesavantages = new ArrayCollection();
  41.         $this->souscroisiere = new ArrayCollection();
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getName(): ?string
  48.     {
  49.         return $this->name;
  50.     }
  51.     public function setName(?string $name): self
  52.     {
  53.         $this->name $name;
  54.         return $this;
  55.     }
  56.     public function getDescription(): ?string
  57.     {
  58.         return $this->description;
  59.     }
  60.     public function setDescription(?string $description): self
  61.     {
  62.         $this->description $description;
  63.         return $this;
  64.     }
  65.     /**
  66.      * @return Collection<int, Imagesavantage>
  67.      */
  68.     public function getImagesavantages(): Collection
  69.     {
  70.         return $this->imagesavantages;
  71.     }
  72.     public function addImagesavantage(Imagesavantage $imagesavantage): self
  73.     {
  74.         if (!$this->imagesavantages->contains($imagesavantage)) {
  75.             $this->imagesavantages[] = $imagesavantage;
  76.             $imagesavantage->setAvantages($this);
  77.         }
  78.         return $this;
  79.     }
  80.     public function removeImagesavantage(Imagesavantage $imagesavantage): self
  81.     {
  82.         if ($this->imagesavantages->removeElement($imagesavantage)) {
  83.             // set the owning side to null (unless already changed)
  84.             if ($imagesavantage->getAvantages() === $this) {
  85.                 $imagesavantage->setAvantages(null);
  86.             }
  87.         }
  88.         return $this;
  89.     }
  90.     public function isEtat(): ?bool
  91.     {
  92.         return $this->etat;
  93.     }
  94.     public function setEtat(?bool $etat): self
  95.     {
  96.         $this->etat $etat;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection<int, Souscroisiere>
  101.      */
  102.     public function getSouscroisiere(): Collection
  103.     {
  104.         return $this->souscroisiere;
  105.     }
  106.     public function addSouscroisiere(Souscroisiere $souscroisiere): self
  107.     {
  108.         if (!$this->souscroisiere->contains($souscroisiere)) {
  109.             $this->souscroisiere[] = $souscroisiere;
  110.         }
  111.         return $this;
  112.     }
  113.     public function removeSouscroisiere(Souscroisiere $souscroisiere): self
  114.     {
  115.         $this->souscroisiere->removeElement($souscroisiere);
  116.         return $this;
  117.     }
  118. }