<?php
namespace App\Entity;
use App\Repository\FeatureRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: FeatureRepository::class)]
class Feature
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column]
private ?int $position = null;
#[ORM\OneToMany(mappedBy: 'feature', targetEntity: FeatureLang::class)]
private Collection $featureLang;
#[ORM\OneToMany(mappedBy: 'feature', targetEntity: FeatureValue::class)]
private Collection $featureValues;
public function __construct()
{
$this->featureLang = new ArrayCollection();
$this->featureValues = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(int $position): self
{
$this->position = $position;
return $this;
}
/**
* @return Collection<int, FeatureLang>
*/
public function getFeatureLang(): Collection
{
return $this->featureLang;
}
public function addFeatureLang(FeatureLang $featureLang): self
{
if (!$this->featureLang->contains($featureLang)) {
$this->featureLang->add($featureLang);
$featureLang->setFeature($this);
}
return $this;
}
public function removeFeatureLang(FeatureLang $featureLang): self
{
if ($this->featureLang->removeElement($featureLang)) {
// set the owning side to null (unless already changed)
if ($featureLang->getFeature() === $this) {
$featureLang->setFeature(null);
}
}
return $this;
}
/**
* @return Collection<int, FeatureValue>
*/
public function getFeatureValues(): Collection
{
return $this->featureValues;
}
public function addFeatureValue(FeatureValue $featureValue): self
{
if (!$this->featureValues->contains($featureValue)) {
$this->featureValues->add($featureValue);
$featureValue->setFeature($this);
}
return $this;
}
public function removeFeatureValue(FeatureValue $featureValue): self
{
if ($this->featureValues->removeElement($featureValue)) {
// set the owning side to null (unless already changed)
if ($featureValue->getFeature() === $this) {
$featureValue->setFeature(null);
}
}
return $this;
}
}