<?php
namespace App\Entity\Item;
use App\Entity\Blog;
use App\Entity\Package\Package;
use App\Entity\Search\SearchIndustry;
use App\Entity\SeoIndustry;
use App\Entity\Traits\IdTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ItemCategoryRepository::class)
*/
class ItemCategory
{
use IdTrait;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime")
*/
private $updatedAt;
/**
* @ORM\Column(type="string", length=255,nullable=true)
*/
private $name;
/**
* @ORM\Column(type="string", length=255,nullable=true)
*/
private $info;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $fieldType;
/**
* @ORM\Column(type="boolean",nullable=true)
*/
private $canBeNiceToHave;
/**
* @ORM\ManyToMany(targetEntity=Item::class, mappedBy="itemCategories",cascade={"persist","remove","refresh"})
* @ORM\JoinColumn(nullable=true)
*/
private $items;
/**
* @ORM\Column(type="string", length=255,nullable=true)
*/
private $categoryType;
/**
* @ORM\Column(type="boolean",nullable=true)
*/
private $required;
/**
* @ORM\ManyToOne(targetEntity=ItemCategory::class, inversedBy="relatedItemCategories",cascade={"persist","remove"})
* @ORM\JoinColumn(nullable=true)
*/
private $itemCategory;
/**
* @ORM\OneToMany(targetEntity=ItemCategory::class, mappedBy="itemCategory",cascade={"persist","remove"},orphanRemoval=true)
* @ORM\JoinColumn(nullable=true)
*/
private $relatedItemCategories;
/**
* @ORM\Column(type="string",length=255,nullable=true)
*/
private $placeholder;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $canEnterOwn;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $translation;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $showCanNiceToBeHaveButton;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Blog", mappedBy="industry",cascade={"persist","remove"})
* @ORM\JoinColumn(nullable=true)
*/
private $blog;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $active;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isNameOffer;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isLevelOffer;
/**
* @ORM\ManyToOne(targetEntity=SeoIndustry::class, inversedBy="industry", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=true)
*/
private $seoIndustry;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $searchSlug;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $fieldTypeView;
/**
* @ORM\OneToMany(targetEntity=SearchIndustry::class, mappedBy="itemCategory", cascade={"persist","remove"})
*/
private $searchIndustry;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isTechnology;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $itemQuantity = 10;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $position;
/**
* @ORM\ManyToMany(targetEntity=Package::class, mappedBy="industry")
*/
private $packages;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $showLabel;
public function __construct()
{
$this->items = new ArrayCollection();
$this->relatedItemCategories = new ArrayCollection();
$this->blog = new ArrayCollection();
$this->searchIndustry = new ArrayCollection();
$this->packages = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getInfo(): ?string
{
return $this->info;
}
public function setInfo(string $info): self
{
$this->info = $info;
return $this;
}
public function getFieldType(): ?string
{
return $this->fieldType;
}
public function setFieldType(string $fieldType): self
{
$this->fieldType = $fieldType;
return $this;
}
public function getCanBeNiceToHave(): ?bool
{
return $this->canBeNiceToHave;
}
public function setCanBeNiceToHave(bool $canBeNiceToHave): self
{
$this->canBeNiceToHave = $canBeNiceToHave;
return $this;
}
/**
* @return Collection|Item[]
*/
public function getItems(): Collection
{
return $this->items;
}
public function addItem(Item $item): self
{
if (!$this->items->contains($item)) {
$this->items[] = $item;
$item->addItemCategory($this);
}
return $this;
}
public function removeItem(Item $item): self
{
if ($this->items->removeElement($item)) {
// set the owning side to null (unless already changed)
if ($item->getItemCategories() === $this) {
$item->removeItemCategory(null);
}
}
return $this;
}
public function getCategoryType(): ?string
{
return $this->categoryType;
}
public function setCategoryType(string $categoryType): self
{
$this->categoryType = $categoryType;
return $this;
}
public function getRequired(): ?bool
{
return $this->required;
}
public function setRequired(bool $required): self
{
$this->required = $required;
return $this;
}
public function getItemCategory(): ?self
{
return $this->itemCategory;
}
public function setItemCategory(?self $itemCategory): self
{
$this->itemCategory = $itemCategory;
return $this;
}
/**
* @return Collection|self[]
*/
public function getRelatedItemCategories(): Collection
{
return $this->relatedItemCategories;
}
public function addRelatedItemCategory(self $relatedItemCategory): self
{
if (!$this->relatedItemCategories->contains($relatedItemCategory)) {
$this->relatedItemCategories[] = $relatedItemCategory;
$relatedItemCategory->setItemCategory($this);
}
return $this;
}
public function removeRelatedItemCategory(self $relatedItemCategory): self
{
if ($this->relatedItemCategories->removeElement($relatedItemCategory)) {
// set the owning side to null (unless already changed)
if ($relatedItemCategory->getItemCategory() === $this) {
$relatedItemCategory->setItemCategory(null);
}
}
return $this;
}
public function getPlaceholder(): ?string
{
return $this->placeholder;
}
public function setPlaceholder(string $placeholder): self
{
$this->placeholder = $placeholder;
return $this;
}
public function getCanEnterOwn(): ?bool
{
return $this->canEnterOwn;
}
public function setCanEnterOwn(bool $canEnterOwn): self
{
$this->canEnterOwn = $canEnterOwn;
return $this;
}
public function getTranslation(): ?array
{
return $this->translation;
}
public function setTranslation(array $translation): self
{
$this->translation = $translation;
return $this;
}
public function getShowCanNiceToBeHaveButton(): ?bool
{
return $this->showCanNiceToBeHaveButton;
}
public function setShowCanNiceToBeHaveButton(bool $showCanNiceToBeHaveButton): self
{
$this->showCanNiceToBeHaveButton = $showCanNiceToBeHaveButton;
return $this;
}
public function getItemCategoryById(?int $itemCategoryId): ?ItemCategory
{
foreach($this->getRelatedItemCategories()->toArray() as $itemCategory){
if($itemCategory->getId() === $itemCategoryId){ return $itemCategory; }
}
return null;
}
public function getItemFromItemCategoryById(int $itemId): ?Item
{
foreach($this->getItems()->toArray() as $item){
if($item->getId() === $itemId){ return $item; }
}
return null;
}
/**
* @return Collection|Blog[]
*/
public function getBlog(): Collection
{
return $this->blog;
}
public function addBlog(Blog $blog):self
{
$this->blog[] = $blog;
return $this;
}
public function removeBlog(Blog $blog):self
{
if ($this->blog->removeElement($blog)) {
// set the owning side to null (unless already changed)
if ($blog->getIndustry() === $this) {
$blog->setIndustry(null);
}
}
return $this;
}
public function getActive(): ?bool
{
return $this->active;
}
public function setActive(bool $active): self
{
$this->active = $active;
return $this;
}
public function getIsNameOffer(): ?bool
{
return $this->isNameOffer;
}
public function setIsNameOffer(bool $isNameOffer): self
{
$this->isNameOffer = $isNameOffer;
return $this;
}
public function setIsLevelOffer(bool $isLevelOffer): self
{
$this->isLevelOffer = $isLevelOffer;
return $this;
}
public function getIsLevelOffer(): ?bool
{
return $this->isLevelOffer;
}
public function setSeoIndustry(?SeoIndustry $seoIndustry): self
{
$this->seoIndustry = $seoIndustry;
return $this;
}
public function getSeoIndustry(): ?SeoIndustry
{
return $this->seoIndustry;
}
/**
* @return string|null
*/
public function getSearchSlug(): ?string
{
return $this->searchSlug;
}
/**
* @param string|null $searchSlug
*/
public function setSearchSlug(?string $searchSlug): self
{
$this->searchSlug = $searchSlug;
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;
}
/**
* @return Collection|Blog[]
*/
public function getSearchIndustry(): Collection
{
return $this->searchIndustry;
}
public function addSearchIndustry(?SearchIndustry $searchIndustry):self
{
$this->searchIndustry[] = $searchIndustry;
return $this;
}
public function removeSearchIndustry(?SearchIndustry $searchIndustry):self
{
if ($this->searchIndustry->removeElement($searchIndustry)) {
// set the owning side to null (unless already changed)
if ($searchIndustry->getItemCategory() === $this) {
$searchIndustry->setItemCategory(null);
}
}
return $this;
}
public function getIsTechnology(): ?bool
{
return $this->isTechnology;
}
public function setIsTechnology(?bool $isTechnology): self
{
$this->isTechnology = $isTechnology;
return $this;
}
public function getItemQuantity(): ?int
{
return $this->itemQuantity;
}
public function setItemQuantity(?int $itemQuantity): self
{
$this->itemQuantity = $itemQuantity;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): self
{
$this->position = $position;
return $this;
}
public function getPackages(): ArrayCollection
{
return $this->packages;
}
public function addPackage(?Package $package): self
{
if (!$this->packages->contains($package)) {
$this->packages[] = $package;
}
return $this;
}
public function removePackage(?Package $package): self
{
$this->packages->removeElement($package);
return $this;
}
public function getShowLabel()
{
return $this->showLabel;
}
public function setShowLabel(bool $showLabel): self
{
$this->showLabel = $showLabel;
return $this;
}
}