<?php
namespace App\Entity;
use App\Repository\AttributeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AttributeRepository::class)]
class Attribute
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\OneToMany(mappedBy: 'attribute', targetEntity: AttributeLang::class)]
private Collection $attributeLang;
#[ORM\OneToMany(mappedBy: 'attribute', targetEntity: AttributeValue::class)]
private Collection $attributeValues;
#[ORM\Column]
private ?int $position = null;
#[ORM\Column(length: 255)]
private ?string $type = null;
public function __construct()
{
$this->attributeLang = new ArrayCollection();
$this->attributeValues = new ArrayCollection();
$this->productAttributes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection<int, AttributeLang>
*/
public function getAttributeLang(): Collection
{
return $this->attributeLang;
}
public function addAttributeLang(AttributeLang $attributeLang): self
{
if (!$this->attributeLang->contains($attributeLang)) {
$this->attributeLang->add($attributeLang);
$attributeLang->setAttribute($this);
}
return $this;
}
public function removeAttributeLang(AttributeLang $attributeLang): self
{
if ($this->attributeLang->removeElement($attributeLang)) {
// set the owning side to null (unless already changed)
if ($attributeLang->getAttribute() === $this) {
$attributeLang->setAttribute(null);
}
}
return $this;
}
/**
* @return Collection<int, AttributeValue>
*/
public function getAttributeValues(): Collection
{
return $this->attributeValues;
}
public function addAttributeValue(AttributeValue $attributeValue): self
{
if (!$this->attributeValues->contains($attributeValue)) {
$this->attributeValues->add($attributeValue);
$attributeValue->setAttribute($this);
}
return $this;
}
public function removeAttributeValue(AttributeValue $attributeValue): self
{
if ($this->attributeValues->removeElement($attributeValue)) {
// set the owning side to null (unless already changed)
if ($attributeValue->getAttribute() === $this) {
$attributeValue->setAttribute(null);
}
}
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(int $position): self
{
$this->position = $position;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
}