<?phpnamespace App\Entity;use App\Entity\Traits\CommonTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;/** * @ORM\Entity(repositoryClass="App\Repository\ItemSpecRepository") * @ORM\Table(name="itm_spec") * @UniqueEntity({"uuid"}) * @ORM\HasLifecycleCallbacks() */class ItemSpec{ use CommonTrait; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $value; /** * @ORM\ManyToOne(targetEntity=ItemSpecTypes::class, inversedBy="itemSpecValues", cascade={"persist"}) * @ORM\JoinColumn(nullable=false) */ private $itemSpecType; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $hiddenValue; /** * @ORM\Column(type="boolean", nullable=true) */ private $isTop; /** * @ORM\ManyToOne(targetEntity=ItemSpecTypes::class, inversedBy="parentSpec", cascade={"persist"}) */ private $childSpecType; public function getValue(): ?string { return $this->value; } public function setValue(string $value): self { $this->value = $value; return $this; } public function getItemSpecType(): ?ItemSpecTypes { return $this->itemSpecType; } public function setItemSpecType(?ItemSpecTypes $itemSpecType): self { $this->itemSpecType = $itemSpecType; return $this; } public function __toString() { return $this->value; } public function getHiddenValue(): ?string { return $this->hiddenValue; } public function setHiddenValue(?string $hiddenValue): self { $this->hiddenValue = $hiddenValue; return $this; } public function getSpecValue() { if($this->hiddenValue) { return $this->getItemSpecType()->getViewPrefix() . ' ' . $this->hiddenValue . ' ' . $this->getItemSpecType()->getViewSuffix(); } if($this->value) { return $this->getItemSpecType()->getViewPrefix() . ' ' . $this->value . ' ' . $this->getItemSpecType()->getViewSuffix(); } return ''; } public function getChildSpecType(): ?ItemSpecTypes { return $this->childSpecType; } public function setChildSpecType(?ItemSpecTypes $childSpecType): self { if(!$childSpecType) { return $this; } $childSpecType->setParentSpec($this); $this->childSpecType = $childSpecType; return $this; } public function getIsTop(): ?bool { return $this->isTop; } public function setIsTop(?bool $isTop): self { $this->isTop = $isTop; return $this; }}