<?php
namespace App\Entity\Gos;
use App\Entity\Gos\Tmpl\Template;
use App\Entity\Gos\Tmpl\TmplModuleContent;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\File;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Table()
* @ORM\Entity(repositoryClass="App\Repository\Gos\ProductAssociationRepository")
* @ORM\HasLifecycleCallbacks
* @Vich\Uploadable
*/
class ProductAssociation
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Gos\Product", inversedBy="productAssociation", fetch="EAGER")
* @ORM\JoinTable()
*/
private $products;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="productAssociation")
*/
private $productVariants;
/**
* @ORM\OneToMany(
* targetEntity="App\Entity\Gos\ProductImage",
* mappedBy="productAssociation",
* cascade={"persist", "remove"},
* orphanRemoval=true
* )
* @ORM\OrderBy({"position" = "ASC"})
*/
private $productImages;
/**
* @ORM\OneToMany(
* targetEntity="App\Entity\Gos\ProductMovie",
* mappedBy="productAssociation",
* cascade={"persist", "remove"},
* orphanRemoval=true
* )
* @ORM\OrderBy({"position" = "ASC"}))
* @Assert\Count(max=1, maxMessage="You can upload maximum {{ limit }} movie")
*/
private $productMovies;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @var string
*/
private $previewFragment;
/**
* @Vich\UploadableField(mapping="product_files", fileNameProperty="previewFragment")
* @Assert\File(
* maxSize = "50M",
* maxSizeMessage = "File is too big, allowed maximum size is {{ limit }} {{ suffix }}"
* )
* @var File
*/
private $previewFragmentFile;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @var string
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $title;
/**
* @var string
*
* @Gedmo\Slug(fields={"title"}, unique=true, updatable=true)
* @ORM\Column(type="string", length=191, nullable=true, unique=true)
*/
private $slug;
/**
* @var string
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $subtitle;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $frontendDescription;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $frontendDescriptionShort;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Gos\PortalSettings", inversedBy="productAssociations")
*/
private $portalSettings;
/**
* @var bool
*
* @ORM\Column(type="boolean", options={"default": 0})
*/
private $isRecommended = 0;
/**
* @ORM\Column(type="boolean", options={"default": 0})
*/
private $isMostBought = 0;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @var string
*/
private $logo;
/**
* @Vich\UploadableField(mapping="product_images", fileNameProperty="logo")
* @Assert\File(
* maxSize = "2M",
* maxSizeMessage = "File is too big, allowed maximum size is {{ limit }} {{ suffix }}"
* )
* @var File
*/
private $logoFile;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @var string
*/
private $background;
/**
* @Vich\UploadableField(mapping="product_images", fileNameProperty="background")
* @Assert\File(
* maxSize = "6M",
* maxSizeMessage = "File is too big, allowed maximum size is {{ limit }} {{ suffix }}"
* )
* @var File
*/
private $backgroundFile;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @var string
*/
private $partnerLogo;
/**
* @Vich\UploadableField(mapping="product_images", fileNameProperty="partnerLogo")
* @Assert\File(
* maxSize = "2M",
* maxSizeMessage = "File is too big, allowed maximum size is {{ limit }} {{ suffix }}"
* )
* @var File
*/
private $partnerLogoFile;
/**
* @var int
*
* @ORM\Column(type="integer", nullable=true)
*/
private $defaultQuantityTicket;
/**
* @ORM\ManyToOne(targetEntity="Coupon", inversedBy="productAssociation")
* @ORM\JoinColumn()
*/
private $couponDefault;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $customScripts;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Gos\Category", mappedBy="recommendedProductAssociation")
*/
private $recommendedByCategory;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Gos\Category", inversedBy="productAssociationMaster")
* @ORM\JoinColumn()
* @Assert\NotNull(message = "This field can't be empty")
*/
private $categoryMaster;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Gos\Category", inversedBy="productAssociations")
* @ORM\JoinTable(name="category_product_association")
*/
private $categories;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Gos\Tmpl\Template", mappedBy="productAssociation", cascade={"persist", "remove"})
*/
private $template;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Gos\Tmpl\TmplModuleContent", mappedBy="productAssociation", orphanRemoval=true)
*/
private $tmplModuleContents;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Gos\ProductMainType", inversedBy="productAssociations", cascade={"persist"})
*/
private $productMainType;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Gos\ProductTypeDetailDescription", mappedBy="productAssociation", cascade={"persist", "remove"})
*/
private $productTypeDetailDescriptions;
/**
* @ORM\OneToMany(targetEntity="ProductRelease", mappedBy="productAssociation", cascade={"persist"})
*/
private $productRelease;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Gos\MetaTags", mappedBy="productAssociation")
*/
private $metaTags;
/**
* @ORM\Column(type="boolean", options={"default":0})
*/
private $isHidden = false;
/**
* @ORM\Column(type="integer", nullable=true, options={"default":1})
* @Assert\Positive
*/
private $numberOfAccessToLastReleases;
/**
* @ORM\OneToMany(targetEntity="ProductCart", mappedBy="productAssociation")
*/
private $productCart;
/**
* @ORM\Column(type="boolean", options={"default":0})
*/
private $useHtmlLanding = false;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $customHead;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $customCss;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $customLanding;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $landingFullWidth;
public function __toString()
{
return $this->getTitle() ?? '';
}
public function checkIfHaveDifferentProductGosType()
{
$productGosType = null;
/** @var Product $product */
foreach ($this->getProducts() as $key => $product)
{
if (empty($product->getProductGosType()))
{
return true;
}
if ($key == 0)
{
$productGosType = $product->getProductGosType()->getName();
}
elseif ($productGosType != $product->getProductGosType()->getName())
{
return true;
}
}
return false;
}
public function getActiveProductTypeDetailDescriptions(): ArrayCollection
{
$data = new ArrayCollection();
foreach ($this->getProductTypeDetailDescriptions() as $description)
{
if ($description->getProductTypeDetail())
{
$data[] = $description;
}
}
return $data;
}
public function getMainCategory(): ?Category
{
if (
$this->getCategoryMaster() instanceof Category
&& $this->getCategoryMaster()->getParent() instanceof Category
)
{
return $this->getCategoryMaster()->getParent();
}
return null;
}
public function getParentCategorySlug()
{
if ($this->getMainCategory() instanceof Category)
{
return $this->getMainCategory()->getCategorySlug();
}
return 'category';
}
public function getCategorySlug()
{
if ($this->getCategoryMaster() instanceof Category)
{
return $this->getCategoryMaster()->getCategorySlug();
}
return 'child-category';
}
/**
* @return Collection|Category[]
*/
public function getAllCategory(): Collection
{
$array = $this->categories->toArray();
if (!empty($this->categoryMaster))
{
$array[] = $this->categoryMaster;
}
return new ArrayCollection($array);
}
public function getAllCategoriesForElastica()
{
$allCategories = $this->getAllCategory()->toArray();
foreach ($allCategories as $category)
{
if ($category->getParent() && !in_array($category->getParent(), $allCategories))
{
$allCategories[] = $category->getParent();
}
}
return new ArrayCollection($allCategories);
}
public function getPublishedVariants()
{
$variants = array();
foreach ($this->getProductVariants() as $productVariant)
{
/** @var ProductVariant $productVariant */
if ($productVariant->getIsPublished())
$variants[] = $productVariant;
}
usort($variants, function($first, $second)
{
return $first->getFullPrice('net') > $second->getFullPrice('net');
});
return $variants;
}
/**
* Used for dynamic suggestions in e-forum search bar
*/
public function getNameSuggest()
{
return array(
'input' => explode(" ", $this->getTitle()),
'output' => $this->getTitle(),
'payload' => array(
'id' => $this->getId()
)
);
}
public function checkCouponDefault($productVariant = null)
{
if (
!empty($this->getCouponDefault())
&& $this->getCouponDefault()->getIsActive()
&& $this->getCouponDefault()->getDateFrom() < new \DateTime('now')
&& $this->getCouponDefault()->getDateTo() > new \DateTime('now')
&&
(
$this->getCouponDefault()->getMaximumQuantityUse() == 0
|| $this->getCouponDefault()->getMaximumQuantityUse() - $this->getCouponDefault()->getUsedCodes() > 0
)
)
{
if (empty($productVariant))
{
$variants = array();
foreach ($this->getProducts() as $product)
{
foreach ($product->getProductVariant() as $variant)
{
$variants[] = $variant;
}
}
$arr = array_map(
function($productVariant){return $productVariant->getProductVariantNoComplete();},
$variants
);
if ($this->getCouponDefault()->isInProductVariantList($arr))
{
return true;
}
}
elseif ($this->getCouponDefault()->isInProductVariantList(array($productVariant->getProductVariantNoComplete())))
{
return true;
}
}
return false;
}
public function getEventType()
{
if (!$this->getProducts()->isEmpty())
{
/** @var Product $product */
foreach ($this->getProducts() as $product)
{
if ($product->getEventType())
{
return $product->getEventType();
}
}
}
if (!$this->getProductVariants()->isEmpty())
{
/** @var ProductVariant $productVariant */
foreach ($this->getProductVariants() as $productVariant)
{
if ($productVariant->getMasterProduct()->getEventType())
{
return $productVariant->getMasterProduct()->getEventType();
}
}
}
return null;
}
public function getEventDate()
{
if (!$this->getProducts()->isEmpty())
{
/** @var Product $product */
foreach ($this->getProducts() as $product)
{
if ($product->getEventDate())
{
return $product->getEventDate();
}
}
}
if (!$this->getProductVariants()->isEmpty())
{
/** @var ProductVariant $productVariant */
foreach ($this->getProductVariants() as $productVariant)
{
if ($productVariant->getMasterProduct()->getEventDate())
{
return $productVariant->getMasterProduct()->getEventDate();
}
}
}
return null;
}
public function getEventPlaceName()
{
if (!$this->getProducts()->isEmpty())
{
/** @var Product $product */
foreach ($this->getProducts() as $product)
{
if ($product->getEventPlaceName())
{
return $product->getEventPlaceName();
}
}
}
if (!$this->getProductVariants()->isEmpty())
{
/** @var ProductVariant $productVariant */
foreach ($this->getProductVariants() as $productVariant)
{
if ($productVariant->getMasterProduct()->getEventPlaceName())
{
return $productVariant->getMasterProduct()->getEventPlaceName();
}
}
}
return null;
}
public function getEventPlaceDesc()
{
if (!$this->getProducts()->isEmpty())
{
/** @var Product $product */
foreach ($this->getProducts() as $product)
{
if ($product->getEventPlaceDesc())
{
return $product->getEventPlaceDesc();
}
}
}
if (!$this->getProductVariants()->isEmpty())
{
/** @var ProductVariant $productVariant */
foreach ($this->getProductVariants() as $productVariant)
{
if ($productVariant->getMasterProduct()->getEventPlaceDesc())
{
return $productVariant->getMasterProduct()->getEventPlaceDesc();
}
}
}
return null;
}
public function countTickets()
{
$event = false;
foreach ($this->getProducts() as $product)
{
if ($product->getIsEvent()) $event = true;
}
if (!$event) return false;
if (!empty($this->getDefaultQuantityTicket()))
{
return $this->getDefaultQuantityTicket();
}
$result = 0;
foreach ($this->getProducts() as $product)
{
foreach ($product->getProductVariant() as $productVariant)
{
if ($productVariant->getQuantity())
{
$result += $productVariant->getQuantity() - $productVariant->getOrderQuantity();
}
}
}
return max($result, 0);
}
/** @ORM\PreUpdate() */
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
public function __construct()
{
$this->products = new ArrayCollection();
$this->productImages = new ArrayCollection();
$this->productMovies = new ArrayCollection();
$this->tmplModuleContents = new ArrayCollection();
$this->productTypeDetailDescriptions = new ArrayCollection();
$this->productRelease = new ArrayCollection();
$this->categories = new ArrayCollection();
$this->productVariants = new ArrayCollection();
$this->productCart = new ArrayCollection();
}
public function setCouponDefault(?Coupon $couponDefault): self
{
$this->couponDefault = $couponDefault;
return $this;
}
public function getCouponDefault(): ?Coupon
{
if (
!empty($this->couponDefault)
&& !empty($this->couponDefault->getCouponType())
&&
(
$this->couponDefault->getCouponType()->getId() == 1
|| $this->couponDefault->getCouponType()->getId() == 2
)
)
{
return $this->couponDefault;
}
return null;
}
public function setPartnerLogoFile(File $partnerLogoFile = null)
{
$this->partnerLogoFile = $partnerLogoFile;
// VERY IMPORTANT:
// It is required that at least one field changes if you are using Doctrine,
// otherwise the event listeners won't be called and the file is lost
if ($partnerLogoFile)
{
// if 'updatedAt' is not defined in your entity, use another property
$this->updatedAt = new \DateTime('now');
}
}
public function getPartnerLogoFile()
{
return $this->partnerLogoFile;
}
public function setPartnerLogo($partnerLogo)
{
$this->partnerLogo = $partnerLogo;
}
public function getPartnerLogo()
{
return $this->partnerLogo;
}
public function setLogoFile(File $logoFile = null)
{
$this->logoFile = $logoFile;
// VERY IMPORTANT:
// It is required that at least one field changes if you are using Doctrine,
// otherwise the event listeners won't be called and the file is lost
if ($logoFile)
{
// if 'updatedAt' is not defined in your entity, use another property
$this->updatedAt = new \DateTime('now');
}
}
public function getLogoFile()
{
return $this->logoFile;
}
public function setLogo($logo)
{
$this->logo = $logo;
}
public function getLogo()
{
return $this->logo;
}
public function setPreviewFragmentFile(File $file = null)
{
$this->previewFragmentFile = $file;
// VERY IMPORTANT:
// It is required that at least one field changes if you are using Doctrine,
// otherwise the event listeners won't be called and the file is lost
if ($file)
{
// if 'updatedAt' is not defined in your entity, use another property
$this->updatedAt = new \DateTime('now');
}
}
public function getPreviewFragmentFile()
{
return $this->previewFragmentFile;
}
public function setPreviewFragment($fileName)
{
$this->previewFragment = $fileName;
}
public function getPreviewFragment()
{
return $this->previewFragment;
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection
*/
public function getProducts(): Collection
{
return $this->products;
}
/**
* @param Product $product
* @return ProductAssociation
*/
public function addProduct(Product $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->addProductAssociation($this);
}
return $this;
}
/**
* @param ProductVariant $productVariant
* @return ProductAssociation
*/
public function removeProduct(Product $product): self
{
if ($this->products->contains($product)) {
$this->products->removeElement($product);
$product->removeProductAssociation($this);
}
return $this;
}
/**
* @return Collection
*/
public function getProductVariants(): Collection
{
return $this->productVariants;
}
/**
* @param ProductVariant $productVariant
* @return ProductAssociation
*/
public function addProductVariant(ProductVariant $productVariant): self
{
if (!$this->productVariants->contains($productVariant)) {
$this->productVariants[] = $productVariant;
$productVariant->addProductAssociation($this);
}
return $this;
}
/**
* @param ProductVariant $productVariant
* @return ProductAssociation
*/
public function removeProductVariant(ProductVariant $productVariant): self
{
if ($this->productVariants->contains($productVariant)) {
$this->productVariants->removeElement($productVariant);
$productVariant->removeProductAssociation($this);
}
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getSubtitle(): ?string
{
return $this->subtitle;
}
public function setSubtitle(?string $subtitle): self
{
$this->subtitle = $subtitle;
return $this;
}
public function getFrontendDescription(): ?string
{
return $this->frontendDescription;
}
public function setFrontendDescription(?string $frontendDescription): self
{
$this->frontendDescription = $frontendDescription;
return $this;
}
public function getFrontendDescriptionShort(): ?string
{
return $this->frontendDescriptionShort;
}
public function setFrontendDescriptionShort(?string $frontendDescriptionShort): self
{
$this->frontendDescriptionShort = $frontendDescriptionShort;
return $this;
}
public function getIsRecommended(): ?bool
{
return $this->isRecommended;
}
public function setIsRecommended(bool $isRecommended): self
{
$this->isRecommended = $isRecommended;
return $this;
}
public function getIsMostBought(): ?bool
{
return $this->isMostBought;
}
public function setIsMostBought(bool $isMostBought): self
{
$this->isMostBought = $isMostBought;
return $this;
}
public function getDefaultQuantityTicket(): ?int
{
return $this->defaultQuantityTicket;
}
public function setDefaultQuantityTicket(?int $defaultQuantityTicket): self
{
$this->defaultQuantityTicket = $defaultQuantityTicket;
return $this;
}
public function getCustomScripts(): ?string
{
return $this->customScripts;
}
public function setCustomScripts(?string $customScripts): self
{
$this->customScripts = $customScripts;
return $this;
}
/**
* @return Collection|ProductImage[]
*/
public function getProductImages(): Collection
{
return $this->productImages;
}
public function addProductImage(ProductImage $productImage): self
{
if (!$this->productImages->contains($productImage)) {
$this->productImages[] = $productImage;
$productImage->setProductAssociation($this);
}
return $this;
}
public function removeProductImage(ProductImage $productImage): self
{
if ($this->productImages->contains($productImage)) {
$this->productImages->removeElement($productImage);
// set the owning side to null (unless already changed)
if ($productImage->getProductAssociation() === $this) {
$productImage->setProductAssociation(null);
}
}
return $this;
}
/**
* @return Collection|ProductMovie[]
*/
public function getProductMovies(): Collection
{
return $this->productMovies;
}
public function addProductMovie(ProductMovie $productMovie): self
{
if (!$this->productMovies->contains($productMovie)) {
$this->productMovies[] = $productMovie;
$productMovie->setProductAssociation($this);
}
return $this;
}
public function removeProductMovie(ProductMovie $productMovie): self
{
if ($this->productMovies->contains($productMovie)) {
$this->productMovies->removeElement($productMovie);
// set the owning side to null (unless already changed)
if ($productMovie->getProductAssociation() === $this) {
$productMovie->setProductAssociation(null);
}
}
return $this;
}
public function getPortalSettings(): ?PortalSettings
{
return $this->portalSettings;
}
public function setPortalSettings(?PortalSettings $portalSettings): self
{
$this->portalSettings = $portalSettings;
return $this;
}
public function getRecommendedByCategory(): ?Category
{
return $this->recommendedByCategory;
}
public function setRecommendedByCategory(?Category $recommendedByCategory): self
{
$this->recommendedByCategory = $recommendedByCategory;
// set (or unset) the owning side of the relation if necessary
$newRecommendedProductAssociation = $recommendedByCategory === null ? null : $this;
if ($newRecommendedProductAssociation !== $recommendedByCategory->getRecommendedProductAssociation()) {
$recommendedByCategory->setRecommendedProductAssociation($newRecommendedProductAssociation);
}
return $this;
}
public function getTemplate(): ?Template
{
return $this->template;
}
public function setTemplate(?Template $template): self
{
$this->template = $template;
// set (or unset) the owning side of the relation if necessary
$newProductAssociation = $template === null ? null : $this;
if ($newProductAssociation !== $template->getProductAssociation()) {
$template->setProductAssociation($newProductAssociation);
}
return $this;
}
/**
* @return Collection|TmplModuleContent[]
*/
public function getTmplModuleContents(): Collection
{
return $this->tmplModuleContents;
}
public function addTmplModuleContent(TmplModuleContent $tmplModuleContent): self
{
if (!$this->tmplModuleContents->contains($tmplModuleContent)) {
$this->tmplModuleContents[] = $tmplModuleContent;
$tmplModuleContent->setProductAssociation($this);
}
return $this;
}
public function removeTmplModuleContent(TmplModuleContent $tmplModuleContent): self
{
if ($this->tmplModuleContents->contains($tmplModuleContent)) {
$this->tmplModuleContents->removeElement($tmplModuleContent);
// set the owning side to null (unless already changed)
if ($tmplModuleContent->getProductAssociation() === $this) {
$tmplModuleContent->setProductAssociation(null);
}
}
return $this;
}
public function getProductMainType(): ?ProductMainType
{
return $this->productMainType;
}
public function setProductMainType(?ProductMainType $productMainType): self
{
$this->productMainType = $productMainType;
return $this;
}
/**
* @return Collection|ProductTypeDetailDescription[]
*/
public function getProductTypeDetailDescriptions(): Collection
{
return $this->productTypeDetailDescriptions;
}
public function addProductTypeDetailDescription(ProductTypeDetailDescription $productTypeDetailDescription): self
{
if (!$this->productTypeDetailDescriptions->contains($productTypeDetailDescription)) {
$this->productTypeDetailDescriptions[] = $productTypeDetailDescription;
$productTypeDetailDescription->setProductAssociation($this);
}
return $this;
}
public function removeProductTypeDetailDescription(ProductTypeDetailDescription $productTypeDetailDescription): self
{
if ($this->productTypeDetailDescriptions->contains($productTypeDetailDescription)) {
$this->productTypeDetailDescriptions->removeElement($productTypeDetailDescription);
// set the owning side to null (unless already changed)
if ($productTypeDetailDescription->getProductAssociation() === $this) {
$productTypeDetailDescription->setProductAssociation(null);
}
}
return $this;
}
public function setProductTypeDetailDescriptions(ArrayCollection $productTypeDetailDescriptions): self
{
$this->productTypeDetailDescriptions = $productTypeDetailDescriptions;
return $this;
}
/**
* @return Collection|ProductRelease[]
*/
public function getProductRelease(): Collection
{
return $this->productRelease;
}
public function addProductRelease(ProductRelease $productRelease): self
{
if (!$this->productRelease->contains($productRelease)) {
$this->productRelease[] = $productRelease;
$productRelease->setProductAssociation($this);
}
return $this;
}
public function removeProductRelease(ProductRelease $productRelease): self
{
if ($this->productRelease->contains($productRelease)) {
$this->productRelease->removeElement($productRelease);
// set the owning side to null (unless already changed)
if ($productRelease->getProductAssociation() === $this) {
$productRelease->setProductAssociation(null);
}
}
return $this;
}
public function getMetaTags(): ?MetaTags
{
return $this->metaTags;
}
public function setMetaTags(?MetaTags $metaTags): self
{
$this->metaTags = $metaTags;
// set (or unset) the owning side of the relation if necessary
$newProductAssociation = $metaTags === null ? null : $this;
if ($newProductAssociation !== $metaTags->getProductAssociation()) {
$metaTags->setProductAssociation($newProductAssociation);
}
return $this;
}
public function getCategoryMaster(): ?Category
{
return $this->categoryMaster;
}
public function setCategoryMaster(?Category $categoryMaster): self
{
$this->categoryMaster = $categoryMaster;
return $this;
}
/**
* @return Collection|Category[]
*/
public function getCategories(): Collection
{
return $this->categories;
}
public function addCategory(Category $category): self
{
if (!$this->categories->contains($category)) {
$this->categories[] = $category;
$category->addProductAssociation($this);
}
return $this;
}
public function removeCategory(Category $category): self
{
if ($this->categories->contains($category)) {
$this->categories->removeElement($category);
$category->removeProductAssociation($this);
}
return $this;
}
public function getIsHidden(): bool
{
return $this->isHidden;
}
public function setIsHidden(bool $isHidden): self
{
$this->isHidden = $isHidden;
return $this;
}
/**
* @return Collection|ProductCart[]
*/
public function getProductCart(): Collection
{
return $this->productCart;
}
public function addProductCart(ProductCart $productCart): self
{
if (!$this->productCart->contains($productCart)) {
$this->productCart[] = $productCart;
$productCart->setProductAssociation($this);
}
return $this;
}
public function removeProductCart(ProductCart $productCart): self
{
if ($this->productCart->contains($productCart)) {
$this->productCart->removeElement($productCart);
// set the owning side to null (unless already changed)
if ($productCart->getProductVariant() === $this) {
$productCart->setProductAssociation(null);
}
}
return $this;
}
public function getBackground(): ?string
{
return $this->background;
}
public function setBackground(?string $background): self
{
$this->background = $background;
return $this;
}
public function setBackgroundFile(File $backgroundFile = null)
{
$this->backgroundFile = $backgroundFile;
// VERY IMPORTANT:
// It is required that at least one field changes if you are using Doctrine,
// otherwise the event listeners won't be called and the file is lost
if ($backgroundFile)
{
// if 'updatedAt' is not defined in your entity, use another property
$this->updatedAt = new \DateTime('now');
}
}
public function getBackgroundFile()
{
return $this->backgroundFile;
}
public function getNumberOfAccessToLastReleases(): ?int
{
return $this->numberOfAccessToLastReleases;
}
public function setNumberOfAccessToLastReleases(?int $numberOfAccessToLastReleases): self
{
$this->numberOfAccessToLastReleases = $numberOfAccessToLastReleases;
return $this;
}
public function hasCycles(): bool
{
foreach ($this->getProducts() as $product)
{
if ($product->getProductType() && $product->getProductType()->hasCycles())
{
return true;
}
}
return false;
}
public function getUseHtmlLanding(): ?bool
{
return $this->useHtmlLanding;
}
public function setUseHtmlLanding(bool $useHtmlLanding): self
{
$this->useHtmlLanding = $useHtmlLanding;
return $this;
}
public function getCustomHead(): ?string
{
return $this->customHead;
}
public function setCustomHead(?string $customHead): self
{
$this->customHead = $customHead;
return $this;
}
public function getCustomCss(): ?string
{
return $this->customCss;
}
public function setCustomCss(?string $customCss): self
{
$this->customCss = $customCss;
return $this;
}
public function getCustomLanding(): ?string
{
return $this->customLanding;
}
public function setCustomLanding(?string $customLanding): self
{
$this->customLanding = $customLanding;
return $this;
}
public function getLandingFullWidth(): ?bool
{
return $this->landingFullWidth;
}
public function setLandingFullWidth(?bool $landingFullWidth): self
{
$this->landingFullWidth = $landingFullWidth;
return $this;
}
}