src/Entity/Attribute.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AttributeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassAttributeRepository::class)]
  8. class Attribute
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\OneToMany(mappedBy'attribute'targetEntityAttributeLang::class)]
  15.     private Collection $attributeLang;
  16.     #[ORM\OneToMany(mappedBy'attribute'targetEntityAttributeValue::class)]
  17.     private Collection $attributeValues;
  18.     #[ORM\Column]
  19.     private ?int $position null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $type null;
  22.     
  23.     public function __construct()
  24.     {
  25.         $this->attributeLang = new ArrayCollection();
  26.         $this->attributeValues = new ArrayCollection();
  27.         $this->productAttributes = new ArrayCollection();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     /**
  34.      * @return Collection<int, AttributeLang>
  35.      */
  36.     public function getAttributeLang(): Collection
  37.     {   
  38.         return $this->attributeLang;
  39.     }
  40.     public function addAttributeLang(AttributeLang $attributeLang): self
  41.     {
  42.         if (!$this->attributeLang->contains($attributeLang)) {
  43.             $this->attributeLang->add($attributeLang);
  44.             $attributeLang->setAttribute($this);
  45.         }
  46.         return $this;
  47.     }
  48.     public function removeAttributeLang(AttributeLang $attributeLang): self
  49.     {
  50.         if ($this->attributeLang->removeElement($attributeLang)) {
  51.             // set the owning side to null (unless already changed)
  52.             if ($attributeLang->getAttribute() === $this) {
  53.                 $attributeLang->setAttribute(null);
  54.             }
  55.         }
  56.         return $this;
  57.     }
  58.     /**
  59.      * @return Collection<int, AttributeValue>
  60.      */
  61.     public function getAttributeValues(): Collection
  62.     {
  63.         return $this->attributeValues;
  64.     }
  65.     public function addAttributeValue(AttributeValue $attributeValue): self
  66.     {
  67.         if (!$this->attributeValues->contains($attributeValue)) {
  68.             $this->attributeValues->add($attributeValue);
  69.             $attributeValue->setAttribute($this);
  70.         }
  71.         return $this;
  72.     }
  73.     public function removeAttributeValue(AttributeValue $attributeValue): self
  74.     {
  75.         if ($this->attributeValues->removeElement($attributeValue)) {
  76.             // set the owning side to null (unless already changed)
  77.             if ($attributeValue->getAttribute() === $this) {
  78.                 $attributeValue->setAttribute(null);
  79.             }
  80.         }
  81.         return $this;
  82.     }
  83.     public function getPosition(): ?int
  84.     {
  85.         return $this->position;
  86.     }
  87.     public function setPosition(int $position): self
  88.     {
  89.         $this->position $position;
  90.         return $this;
  91.     }
  92.     public function getType(): ?string
  93.     {
  94.         return $this->type;
  95.     }
  96.     public function setType(string $type): self
  97.     {
  98.         $this->type $type;
  99.         return $this;
  100.     }
  101. }