src/Entity/Declination.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DeclinationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=DeclinationRepository::class)
  9.  */
  10. class Declination
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.      public function getId(): ?int
  19.     {
  20.         return $this->id;
  21.     }
  22.     
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $name;
  27.     public function getName(): ?string
  28.     {
  29.         return $this->name;
  30.     }
  31.     public function setName(string $name): self
  32.     {
  33.         $this->name $name;
  34.         return $this;
  35.     }
  36.     /**
  37.      * @ORM\ManyToMany(targetEntity=Produit::class, inversedBy="declinations")
  38.      */
  39.     private $Produits;
  40.     /**
  41.      * @ORM\OneToMany(targetEntity=ValueDeclination::class, mappedBy="declination")
  42.      * @ORM\OrderBy({"name" = "ASC"})
  43.      */
  44.     private $valueDeclinations;
  45.     /**
  46.      * @ORM\Column(type="integer", nullable=true)
  47.      */
  48.     private $position;
  49.     
  50.     public function getPosition(): ?int
  51.     {
  52.         return $this->position;
  53.     }
  54.     public function setPosition(?int $position): self
  55.     {
  56.         $this->position $position;
  57.         return $this;
  58.     }
  59.     /**
  60.     * @ORM\Column(type="boolean", options={"default": false})
  61.      */
  62.     private bool $displayInFilter false;
  63.     public function isDisplayInFilter(): bool 
  64.     
  65.         return $this->displayInFilter
  66.     }
  67.     public function setDisplayInFilter(bool $b): self 
  68.     
  69.         $this->displayInFilter $b; return $this
  70.     }
  71.     public function __construct()
  72.     {
  73.         $this->Produits = new ArrayCollection();
  74.         $this->valueDeclinations = new ArrayCollection();
  75.     }
  76.    
  77.     /**
  78.      * @return Collection|Produit[]
  79.      */
  80.     public function getProduits(): Collection
  81.     {
  82.         return $this->Produits;
  83.     }
  84.     public function addProduit(Produit $produit): self
  85.     {
  86.         if( !$this->Produits->contains($produit)) {
  87.             $this->Produits[] = $produit;
  88.         }
  89.         return $this;
  90.     }
  91.     public function removeProduit(Produit $produit): self
  92.     {
  93.         $this->Produits->removeElement($produit);
  94.         return $this;
  95.     }
  96.     /**
  97.      * @return Collection|ValueDeclination[]
  98.      */
  99.     public function getValueDeclinations(): Collection
  100.     {
  101.         return $this->valueDeclinations;
  102.     }
  103.     public function addValueDeclination(ValueDeclination $valueDeclination): self
  104.     {
  105.         if( !$this->valueDeclinations->contains($valueDeclination)) {
  106.             $this->valueDeclinations[] = $valueDeclination;
  107.             $valueDeclination->setDeclination($this);
  108.         }
  109.         return $this;
  110.     }
  111.     public function removeValueDeclination(ValueDeclination $valueDeclination): self
  112.     {
  113.         if( $this->valueDeclinations->removeElement($valueDeclination)) {
  114.             // set the owning side to null (unless already changed)
  115.             if( $valueDeclination->getDeclination() === $this) {
  116.                 $valueDeclination->setDeclination(null);
  117.             }
  118.         }
  119.         return $this;
  120.     }
  121.    
  122. }