src/Entity/Feature.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FeatureRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassFeatureRepository::class)]
  8. class Feature
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column]
  15.     private ?int $position null;
  16.     #[ORM\OneToMany(mappedBy'feature'targetEntityFeatureLang::class)]
  17.     private Collection $featureLang;
  18.     #[ORM\OneToMany(mappedBy'feature'targetEntityFeatureValue::class)]
  19.     private Collection $featureValues;
  20.     public function __construct()
  21.     {
  22.         $this->featureLang = new ArrayCollection();
  23.         $this->featureValues = new ArrayCollection();
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getPosition(): ?int
  30.     {
  31.         return $this->position;
  32.     }
  33.     public function setPosition(int $position): self
  34.     {
  35.         $this->position $position;
  36.         return $this;
  37.     }
  38.     /**
  39.      * @return Collection<int, FeatureLang>
  40.      */
  41.     public function getFeatureLang(): Collection
  42.     {
  43.         return $this->featureLang;
  44.     }
  45.     public function addFeatureLang(FeatureLang $featureLang): self
  46.     {
  47.         if (!$this->featureLang->contains($featureLang)) {
  48.             $this->featureLang->add($featureLang);
  49.             $featureLang->setFeature($this);
  50.         }
  51.         return $this;
  52.     }
  53.     public function removeFeatureLang(FeatureLang $featureLang): self
  54.     {
  55.         if ($this->featureLang->removeElement($featureLang)) {
  56.             // set the owning side to null (unless already changed)
  57.             if ($featureLang->getFeature() === $this) {
  58.                 $featureLang->setFeature(null);
  59.             }
  60.         }
  61.         return $this;
  62.     }
  63.     /**
  64.      * @return Collection<int, FeatureValue>
  65.      */
  66.     public function getFeatureValues(): Collection
  67.     {
  68.         return $this->featureValues;
  69.     }
  70.     public function addFeatureValue(FeatureValue $featureValue): self
  71.     {
  72.         if (!$this->featureValues->contains($featureValue)) {
  73.             $this->featureValues->add($featureValue);
  74.             $featureValue->setFeature($this);
  75.         }
  76.         return $this;
  77.     }
  78.     public function removeFeatureValue(FeatureValue $featureValue): self
  79.     {
  80.         if ($this->featureValues->removeElement($featureValue)) {
  81.             // set the owning side to null (unless already changed)
  82.             if ($featureValue->getFeature() === $this) {
  83.                 $featureValue->setFeature(null);
  84.             }
  85.         }
  86.         return $this;
  87.     }
  88. }