<?php
namespace App\Entity;
use App\Repository\FenceDictionaryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
/**
* @ORM\Entity(repositoryClass=FenceDictionaryRepository::class)
*/
class FenceDictionary
{
/**
* Hook timestampable behavior
* updates createdAt, updatedAt fields
*/
use TimestampableEntity;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $type;
/**
* @ORM\Column(type="string", length=255)
*/
private $alfenValue;
/**
* @ORM\ManyToOne(targetEntity=FenceColorDictionary::class, inversedBy="fence")
* @ORM\JoinColumn(nullable=false)
*/
private $fenceColorDictionary;
/**
* @ORM\OneToMany(targetEntity=FenceOffer::class, mappedBy="fence")
*/
private $fenceOffers;
/**
* @ORM\ManyToMany(targetEntity=FenceElementDictionary::class, mappedBy="fences", cascade={"persist"})
*/
private $fenceElementDictionaries;
/**
* @ORM\Column(type="json")
*/
private $defaultQuotationParameters = [];
/**
* @ORM\Column(type="string", length=255)
*/
private $alfenModelValue;
/**
* @ORM\OneToMany(targetEntity=ElementSettings::class, mappedBy="fenceDictionary")
*/
private $elementSettings;
public function __construct()
{
$this->fenceOffers = new ArrayCollection();
$this->fenceElementDictionaries = new ArrayCollection();
$this->elementSettings = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getAlfenValue(): ?string
{
return $this->alfenValue;
}
public function setAlfenValue(string $alfenValue): self
{
$this->alfenValue = $alfenValue;
return $this;
}
public function getFenceColorDictionary(): ?FenceColorDictionary
{
return $this->fenceColorDictionary;
}
public function setFenceColorDictionary(?FenceColorDictionary $fenceColorDictionary): self
{
$this->fenceColorDictionary = $fenceColorDictionary;
return $this;
}
/**
* @return Collection<int, FenceOffer>
*/
public function getFenceOffers(): Collection
{
return $this->fenceOffers;
}
public function addFenceOffer(FenceOffer $fenceOffer): self
{
if (!$this->fenceOffers->contains($fenceOffer)) {
$this->fenceOffers[] = $fenceOffer;
$fenceOffer->setFence($this);
}
return $this;
}
public function removeFenceOffer(FenceOffer $fenceOffer): self
{
if ($this->fenceOffers->removeElement($fenceOffer)) {
// set the owning side to null (unless already changed)
if ($fenceOffer->getFence() === $this) {
$fenceOffer->setFence(null);
}
}
return $this;
}
/**
* @return Collection<int, FenceElementDictionary>
*/
public function getFenceElementDictionaries(): Collection
{
return $this->fenceElementDictionaries;
}
public function addFenceElementDictionary(FenceElementDictionary $fenceElementDictionary): self
{
if (!$this->fenceElementDictionaries->contains($fenceElementDictionary)) {
$this->fenceElementDictionaries[] = $fenceElementDictionary;
$fenceElementDictionary->addFence($this);
}
return $this;
}
public function removeFenceElementDictionary(FenceElementDictionary $fenceElementDictionary): self
{
if ($this->fenceElementDictionaries->removeElement($fenceElementDictionary)) {
$fenceElementDictionary->removeFence($this);
}
return $this;
}
public function __toString()
{
return $this->alfenModelValue;
}
public function getDefaultQuotationParameters(): ?array
{
return $this->defaultQuotationParameters;
}
public function setDefaultQuotationParameters(array $defaultQuotationParameters): self
{
$this->defaultQuotationParameters = $defaultQuotationParameters;
return $this;
}
public function getAlfenModelValue(): ?string
{
return $this->alfenModelValue;
}
public function setAlfenModelValue(string $alfenModelValue): self
{
$this->alfenModelValue = $alfenModelValue;
return $this;
}
/**
* @return Collection<int, ElementSettings>
*/
public function getElementSettings(): Collection
{
return $this->elementSettings;
}
public function addElementSetting(ElementSettings $elementSetting): self
{
if (!$this->elementSettings->contains($elementSetting)) {
$this->elementSettings[] = $elementSetting;
$elementSetting->setFenceDictionary($this);
}
return $this;
}
public function removeElementSetting(ElementSettings $elementSetting): self
{
if ($this->elementSettings->removeElement($elementSetting)) {
// set the owning side to null (unless already changed)
if ($elementSetting->getFenceDictionary() === $this) {
$elementSetting->setFenceDictionary(null);
}
}
return $this;
}
}