<?php
namespace App\Entity\Offer;
use App\Entity\Item\Item;
use App\Entity\Traits\IdTrait;
use App\Entity\Traits\TimeStampAbleTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=OfferItemRepository::class)
* @ORM\HasLifecycleCallbacks
*/
class OfferItem
{
use IdTrait;
use TimeStampAbleTrait;
/**
* @ORM\Column(type="boolean", nullable="true")
*/
private ?bool $niceToHaveButton;
/**
* @ORM\Column(type="text", nullable="true")
*/
private ?string $text;
/**
* @ORM\Column(type="string", length=255, nullable="true")
*/
private ?string $secondLevel;
/**
* @ORM\Column(type="string", length=255, nullable="true")
*/
private ?string $thirdLevel;
/**
* @ORM\ManyToMany(targetEntity=Item::class, cascade={"persist"})
*/
private $items;
public function __construct(
/**
* @ORM\ManyToOne(targetEntity=Offer::class, inversedBy="offerItems")
*/
private $offer,
/**
* @ORM\Column(type="boolean", nullable="true")
*/
private ?bool $niceToHave,
/**
* @ORM\Column(type="string", length=255, nullable="true")
*/
private ?string $categoryType,
/**
* @ORM\Column(type="integer", length=255, nullable="true")
*/
private ?int $itemCategoryId,
/**
* @ORM\Column(type="string", length=255, nullable="true")
*/
private ?string $fieldType,
/**
* @ORM\Column(type="string", length=255, nullable="true")
*/
private ?string $offerItemNamePL,
/**
* @ORM\Column(type="string", length=255, nullable="true")
*/
private ?string $offerItemNameEN,
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private ?bool $isNameOffer,
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private ?bool $isLevelOffer,
/**
* @ORM\Column(type="string", length=255, nullable="true")
*/
private ?string $fieldTypeView,
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $showLabel = false
){
$this->items = new ArrayCollection();
}
public function __clone()
{
$this->id = null;
$this->items = null;
$this->offer = null;
}
public function cloneObject(Offer $offer): self
{
$clone = clone $this;
$clone->offer = $offer;
return $clone;
}
public function addItemsToOfferItem(array $items, OfferItem $offerItem): void
{
$offerItem->items = new ArrayCollection();
foreach($items as $item){
$offerItem->addItem($item);
}
}
/**
* @return mixed
*/
public function getOffer()
{
return $this->offer;
}
/**
* @param mixed $offer
*/
public function setOffer($offer): self
{
$this->offer = $offer;
return $this;
}
/**
* @return bool|null
*/
public function getNiceToHave(): ?bool
{
return $this->niceToHave;
}
/**
* @param bool|null $niceToHave
*/
public function setNiceToHave(?bool $niceToHave): self
{
$this->niceToHave = $niceToHave;
return $this;
}
/**
* @return bool|null
*/
public function getNiceToHaveButton(): ?bool
{
return $this->niceToHaveButton;
}
/**
* @param bool|null $niceToHaveButton
*/
public function setNiceToHaveButton(?bool $niceToHaveButton): self
{
$this->niceToHaveButton = $niceToHaveButton;
return $this;
}
/**
* @return string|null
*/
public function getCategoryType(): ?string
{
return $this->categoryType;
}
/**
* @param string|null $categoryType
*/
public function setCategoryType(?string $categoryType): void
{
$this->categoryType = $categoryType;
}
/**
* @return string|null
*/
public function getText(): ?string
{
return $this->text;
}
/**
* @param string|null $text
*/
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
/**
* @return int|null
*/
public function getItemCategoryId(): ?int
{
return $this->itemCategoryId;
}
/**
* @param int|null $itemCategoryId
*/
public function setItemCategoryId(?int $itemCategoryId): self
{
$this->itemCategoryId = $itemCategoryId;
return $this;
}
/**
* @return Collection|\App\Entity\Item\Item[]
*/
public function getItems(): Collection
{
return $this->items;
}
public function addItem(Item $item): self
{
if (!$this->items->contains($item)) {
$this->items[] = $item;
}
return $this;
}
public function removeItem(Item $item): self
{
$this->items->removeElement($item);
return $this;
}
/**
* @return string|null
*/
public function getFieldType(): ?string
{
return $this->fieldType;
}
/**
* @param int|null $fieldType
*/
public function setFieldType(?int $fieldType): self
{
$this->fieldType = $fieldType;
return $this;
}
/**
* @return string|null
*/
public function getSecondLevel(): ?string
{
return $this->secondLevel;
}
/**
* @param string|null $secondLevel
*/
public function setSecondLevel(?string $secondLevel): self
{
$this->secondLevel = $secondLevel;
return $this;
}
/**
* @return string|null
*/
public function getThirdLevel(): ?string
{
return $this->thirdLevel;
}
/**
* @param string|null $thirdLevel
*/
public function setThirdLevel(?string $thirdLevel): self
{
$this->thirdLevel = $thirdLevel;
return $this;
}
/**
* @return string|null
*/
public function getOfferItemNamePL(): ?string
{
return $this->offerItemNamePL;
}
/**
* @param string|null $offerItemNamePL
*/
public function setOfferItemNamePL(?string $offerItemNamePL): self
{
$this->offerItemNamePL = $offerItemNamePL;
return $this;
}
/**
* @return string|null
*/
public function getOfferItemNameEN(): ?string
{
return $this->offerItemNameEN;
}
/**
* @param string|null $offerItemNameEN
*/
public function setOfferItemNameEN(?string $offerItemNameEN): self
{
$this->offerItemNameEN = $offerItemNameEN;
return $this;
}
/**
* @return bool|null
*/
public function getIsNameOffer(): ?bool
{
return $this->isNameOffer;
}
/**
* @param bool|null $isNameOffer
*/
public function setIsNameOffer(?bool $isNameOffer): self
{
$this->isNameOffer = $isNameOffer;
return $this;
}
/**
* @return bool|null
*/
public function getIsLevelOffer(): ?bool
{
return $this->isLevelOffer;
}
/**
* @param bool|null $isLevelOffer
*/
public function setIsLevelOffer(?bool $isLevelOffer): self
{
$this->isLevelOffer = $isLevelOffer;
return $this;
}
/**
* @return string|null
*/
public function getFieldTypeView(): ?string
{
return $this->fieldTypeView;
}
/**
* @param string|null $fieldTypeView
*/
public function setFieldTypeView(?string $fieldTypeView): self
{
$this->fieldTypeView = $fieldTypeView;
return $this;
}
public function getShowLabel()
{
return $this->showLabel;
}
public function setShowLabel($showLabel): self
{
$this->showLabel = $showLabel;
return $this;
}
}