src/Entity/Gos/ProductAssociation.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Entity\Gos\Tmpl\Template;
  4. use App\Entity\Gos\Tmpl\TmplModuleContent;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use Symfony\Component\HttpFoundation\File\File;
  11. use Gedmo\Mapping\Annotation as Gedmo;
  12. /**
  13.  * @ORM\Table()
  14.  * @ORM\Entity(repositoryClass="App\Repository\Gos\ProductAssociationRepository")
  15.  * @ORM\HasLifecycleCallbacks
  16.  * @Vich\Uploadable
  17.  */
  18. class ProductAssociation
  19. {
  20.     /**
  21.      * @ORM\Id()
  22.      * @ORM\GeneratedValue()
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\Product", inversedBy="productAssociation", fetch="EAGER")
  28.      * @ORM\JoinTable()
  29.      */
  30.     private $products;
  31.     /**
  32.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="productAssociation")
  33.      */
  34.     private $productVariants;
  35.     /**
  36.      * @ORM\OneToMany(
  37.      *     targetEntity="App\Entity\Gos\ProductImage",
  38.      *     mappedBy="productAssociation",
  39.      *     cascade={"persist", "remove"},
  40.      *     orphanRemoval=true
  41.      * )
  42.      * @ORM\OrderBy({"position" = "ASC"})
  43.      */
  44.     private $productImages;
  45.     /**
  46.      * @ORM\OneToMany(
  47.      *     targetEntity="App\Entity\Gos\ProductMovie",
  48.      *     mappedBy="productAssociation",
  49.      *     cascade={"persist", "remove"},
  50.      *     orphanRemoval=true
  51.      * )
  52.      * @ORM\OrderBy({"position" = "ASC"}))
  53.      * @Assert\Count(max=1, maxMessage="You can upload maximum {{ limit }} movie")
  54.      */
  55.     private $productMovies;
  56.     /**
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      * @var string
  59.      */
  60.     private $previewFragment;
  61.     /**
  62.      * @Vich\UploadableField(mapping="product_files", fileNameProperty="previewFragment")
  63.      * @Assert\File(
  64.      *     maxSize = "50M",
  65.      *     maxSizeMessage = "File is too big, allowed maximum size is {{ limit }} {{ suffix }}"
  66.      * )
  67.      * @var File
  68.      */
  69.     private $previewFragmentFile;
  70.     /**
  71.      * @ORM\Column(type="datetime", nullable=true)
  72.      */
  73.     private $updatedAt;
  74.     /**
  75.      * @var string
  76.      *
  77.      * @ORM\Column(type="string", length=255, nullable=true)
  78.      */
  79.     private $title;
  80.     /**
  81.      * @var string
  82.      *
  83.      * @Gedmo\Slug(fields={"title"}, unique=true, updatable=true)
  84.      * @ORM\Column(type="string", length=191, nullable=true, unique=true)
  85.      */
  86.     private $slug;
  87.     /**
  88.      * @var string
  89.      *
  90.      * @ORM\Column(type="string", length=255, nullable=true)
  91.      */
  92.     private $subtitle;
  93.     /**
  94.      * @ORM\Column(type="text", nullable=true)
  95.      */
  96.     private $frontendDescription;
  97.     /**
  98.      * @ORM\Column(type="text", nullable=true)
  99.      */
  100.     private $frontendDescriptionShort;
  101.     /**
  102.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\PortalSettings", inversedBy="productAssociations")
  103.      */
  104.     private $portalSettings;
  105.     /**
  106.      * @var bool
  107.      *
  108.      * @ORM\Column(type="boolean", options={"default": 0})
  109.      */
  110.     private $isRecommended 0;
  111.     /**
  112.      * @ORM\Column(type="boolean", options={"default": 0})
  113.      */
  114.     private $isMostBought 0;
  115.     /**
  116.      * @ORM\Column(type="string", length=255, nullable=true)
  117.      * @var string
  118.      */
  119.     private $logo;
  120.     /**
  121.      * @Vich\UploadableField(mapping="product_images", fileNameProperty="logo")
  122.      * @Assert\File(
  123.      *     maxSize = "2M",
  124.      *     maxSizeMessage = "File is too big, allowed maximum size is {{ limit }} {{ suffix }}"
  125.      * )
  126.      * @var File
  127.      */
  128.     private $logoFile;
  129.     /**
  130.      * @ORM\Column(type="string", length=255, nullable=true)
  131.      * @var string
  132.      */
  133.     private $background;
  134.     /**
  135.      * @Vich\UploadableField(mapping="product_images", fileNameProperty="background")
  136.      * @Assert\File(
  137.      *     maxSize = "6M",
  138.      *     maxSizeMessage = "File is too big, allowed maximum size is {{ limit }} {{ suffix }}"
  139.      * )
  140.      * @var File
  141.      */
  142.     private $backgroundFile;
  143.     /**
  144.      * @ORM\Column(type="string", length=255, nullable=true)
  145.      * @var string
  146.      */
  147.     private $partnerLogo;
  148.     /**
  149.      * @Vich\UploadableField(mapping="product_images", fileNameProperty="partnerLogo")
  150.      * @Assert\File(
  151.      *     maxSize = "2M",
  152.      *     maxSizeMessage = "File is too big, allowed maximum size is {{ limit }} {{ suffix }}"
  153.      * )
  154.      * @var File
  155.      */
  156.     private $partnerLogoFile;
  157.     /**
  158.      * @var int
  159.      *
  160.      * @ORM\Column(type="integer", nullable=true)
  161.      */
  162.     private $defaultQuantityTicket;
  163.     /**
  164.      * @ORM\ManyToOne(targetEntity="Coupon", inversedBy="productAssociation")
  165.      * @ORM\JoinColumn()
  166.      */
  167.     private $couponDefault;
  168.     /**
  169.      * @ORM\Column(type="text", nullable=true)
  170.      */
  171.     private $customScripts;
  172.     /**
  173.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\Category", mappedBy="recommendedProductAssociation")
  174.      */
  175.     private $recommendedByCategory;
  176.     /**
  177.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\Category", inversedBy="productAssociationMaster")
  178.      * @ORM\JoinColumn()
  179.      * @Assert\NotNull(message = "This field can't be empty")
  180.      */
  181.     private $categoryMaster;
  182.     /**
  183.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\Category", inversedBy="productAssociations")
  184.      * @ORM\JoinTable(name="category_product_association")
  185.      */
  186.     private $categories;
  187.     /**
  188.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\Tmpl\Template", mappedBy="productAssociation", cascade={"persist", "remove"})
  189.      */
  190.     private $template;
  191.     /**
  192.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\Tmpl\TmplModuleContent", mappedBy="productAssociation", orphanRemoval=true)
  193.      */
  194.     private $tmplModuleContents;
  195.     /**
  196.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\ProductMainType", inversedBy="productAssociations", cascade={"persist"})
  197.      */
  198.     private $productMainType;
  199.     /**
  200.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\ProductTypeDetailDescription", mappedBy="productAssociation", cascade={"persist", "remove"})
  201.      */
  202.     private $productTypeDetailDescriptions;
  203.     /**
  204.      * @ORM\OneToMany(targetEntity="ProductRelease", mappedBy="productAssociation", cascade={"persist"})
  205.      */
  206.     private $productRelease;
  207.     /**
  208.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\MetaTags", mappedBy="productAssociation")
  209.      */
  210.     private $metaTags;
  211.     /**
  212.      * @ORM\Column(type="boolean", options={"default":0})
  213.      */
  214.     private $isHidden false;
  215.     /**
  216.      * @ORM\Column(type="integer", nullable=true, options={"default":1})
  217.      * @Assert\Positive
  218.      */
  219.     private $numberOfAccessToLastReleases;
  220.     /**
  221.      * @ORM\OneToMany(targetEntity="ProductCart", mappedBy="productAssociation")
  222.      */
  223.     private $productCart;
  224.     /**
  225.      * @ORM\Column(type="boolean", options={"default":0})
  226.      */
  227.     private $useHtmlLanding false;
  228.     /**
  229.      * @ORM\Column(type="text", nullable=true)
  230.      */
  231.     private $customHead;
  232.     /**
  233.      * @ORM\Column(type="text", nullable=true)
  234.      */
  235.     private $customCss;
  236.     /**
  237.      * @ORM\Column(type="text", nullable=true)
  238.      */
  239.     private $customLanding;
  240.     /**
  241.      * @ORM\Column(type="boolean", nullable=true)
  242.      */
  243.     private $landingFullWidth;
  244.     public function __toString()
  245.     {
  246.         return $this->getTitle() ?? '';
  247.     }
  248.     public function checkIfHaveDifferentProductGosType()
  249.     {
  250.         $productGosType null;
  251.         /** @var Product $product */
  252.         foreach ($this->getProducts() as $key => $product)
  253.         {
  254.             if (empty($product->getProductGosType()))
  255.             {
  256.                 return true;
  257.             }
  258.             if ($key == 0)
  259.             {
  260.                 $productGosType $product->getProductGosType()->getName();
  261.             }
  262.             elseif ($productGosType != $product->getProductGosType()->getName())
  263.             {
  264.                 return true;
  265.             }
  266.         }
  267.         return false;
  268.     }
  269.     public function getActiveProductTypeDetailDescriptions(): ArrayCollection
  270.     {
  271.         $data = new ArrayCollection();
  272.         foreach ($this->getProductTypeDetailDescriptions() as $description)
  273.         {
  274.             if ($description->getProductTypeDetail())
  275.             {
  276.                 $data[] = $description;
  277.             }
  278.         }
  279.         return $data;
  280.     }
  281.     public function getMainCategory(): ?Category
  282.     {
  283.         if (
  284.             $this->getCategoryMaster() instanceof Category
  285.             && $this->getCategoryMaster()->getParent() instanceof Category
  286.         )
  287.         {
  288.             return $this->getCategoryMaster()->getParent();
  289.         }
  290.         return null;
  291.     }
  292.     public function getParentCategorySlug()
  293.     {
  294.         if ($this->getMainCategory() instanceof Category)
  295.         {
  296.             return $this->getMainCategory()->getCategorySlug();
  297.         }
  298.         return 'category';
  299.     }
  300.     public function getCategorySlug()
  301.     {
  302.         if ($this->getCategoryMaster() instanceof Category)
  303.         {
  304.             return $this->getCategoryMaster()->getCategorySlug();
  305.         }
  306.         return 'child-category';
  307.     }
  308.     /**
  309.      * @return Collection|Category[]
  310.      */
  311.     public function getAllCategory(): Collection
  312.     {
  313.         $array $this->categories->toArray();
  314.         if (!empty($this->categoryMaster))
  315.         {
  316.             $array[] = $this->categoryMaster;
  317.         }
  318.         return new ArrayCollection($array);
  319.     }
  320.     public function getAllCategoriesForElastica()
  321.     {
  322.         $allCategories $this->getAllCategory()->toArray();
  323.         foreach ($allCategories as $category)
  324.         {
  325.             if ($category->getParent() && !in_array($category->getParent(), $allCategories))
  326.             {
  327.                 $allCategories[] = $category->getParent();
  328.             }
  329.         }
  330.         return new ArrayCollection($allCategories);
  331.     }
  332.     public function getPublishedVariants()
  333.     {
  334.         $variants = array();
  335.         foreach ($this->getProductVariants() as $productVariant)
  336.         {
  337.             /** @var ProductVariant $productVariant */
  338.             if ($productVariant->getIsPublished())
  339.                 $variants[] = $productVariant;
  340.         }
  341.         usort($variants, function($first$second)
  342.         {
  343.             return $first->getFullPrice('net') > $second->getFullPrice('net');
  344.         });
  345.         return $variants;
  346.     }
  347.     /**
  348.      * Used for dynamic suggestions in e-forum search bar
  349.      */
  350.     public function getNameSuggest()
  351.     {
  352.         return array(
  353.             'input'   => explode(" "$this->getTitle()),
  354.             'output'  => $this->getTitle(),
  355.             'payload' => array(
  356.                 'id'    => $this->getId()
  357.             )
  358.         );
  359.     }
  360.     public function checkCouponDefault($productVariant null)
  361.     {
  362.         if (
  363.             !empty($this->getCouponDefault())
  364.             && $this->getCouponDefault()->getIsActive()
  365.             && $this->getCouponDefault()->getDateFrom() < new \DateTime('now')
  366.             && $this->getCouponDefault()->getDateTo() > new \DateTime('now')
  367.             &&
  368.             (
  369.                 $this->getCouponDefault()->getMaximumQuantityUse() == 0
  370.                 || $this->getCouponDefault()->getMaximumQuantityUse() - $this->getCouponDefault()->getUsedCodes() > 0
  371.             )
  372.         )
  373.         {
  374.             if (empty($productVariant))
  375.             {
  376.                 $variants = array();
  377.                 foreach ($this->getProducts() as $product)
  378.                 {
  379.                     foreach ($product->getProductVariant() as $variant)
  380.                     {
  381.                         $variants[] = $variant;
  382.                     }
  383.                 }
  384.                 $arr array_map(
  385.                     function($productVariant){return $productVariant->getProductVariantNoComplete();},
  386.                     $variants
  387.                 );
  388.                 if ($this->getCouponDefault()->isInProductVariantList($arr))
  389.                 {
  390.                     return true;
  391.                 }
  392.             }
  393.             elseif ($this->getCouponDefault()->isInProductVariantList(array($productVariant->getProductVariantNoComplete())))
  394.             {
  395.                 return true;
  396.             }
  397.         }
  398.         return false;
  399.     }
  400.     public function getEventType()
  401.     {
  402.         if (!$this->getProducts()->isEmpty())
  403.         {
  404.             /** @var Product $product */
  405.             foreach ($this->getProducts() as $product)
  406.             {
  407.                 if ($product->getEventType())
  408.                 {
  409.                     return $product->getEventType();
  410.                 }
  411.             }
  412.         }
  413.         if (!$this->getProductVariants()->isEmpty())
  414.         {
  415.             /** @var ProductVariant $productVariant */
  416.             foreach ($this->getProductVariants() as $productVariant)
  417.             {
  418.                 if ($productVariant->getMasterProduct()->getEventType())
  419.                 {
  420.                     return $productVariant->getMasterProduct()->getEventType();
  421.                 }
  422.             }
  423.         }
  424.         return null;
  425.     }
  426.     public function getEventDate()
  427.     {
  428.         if (!$this->getProducts()->isEmpty())
  429.         {
  430.             /** @var Product $product */
  431.             foreach ($this->getProducts() as $product)
  432.             {
  433.                 if ($product->getEventDate())
  434.                 {
  435.                     return $product->getEventDate();
  436.                 }
  437.             }
  438.         }
  439.         if (!$this->getProductVariants()->isEmpty())
  440.         {
  441.             /** @var ProductVariant $productVariant */
  442.             foreach ($this->getProductVariants() as $productVariant)
  443.             {
  444.                 if ($productVariant->getMasterProduct()->getEventDate())
  445.                 {
  446.                     return $productVariant->getMasterProduct()->getEventDate();
  447.                 }
  448.             }
  449.         }
  450.         return null;
  451.     }
  452.     public function getEventPlaceName()
  453.     {
  454.         if (!$this->getProducts()->isEmpty())
  455.         {
  456.             /** @var Product $product */
  457.             foreach ($this->getProducts() as $product)
  458.             {
  459.                 if ($product->getEventPlaceName())
  460.                 {
  461.                     return $product->getEventPlaceName();
  462.                 }
  463.             }
  464.         }
  465.         if (!$this->getProductVariants()->isEmpty())
  466.         {
  467.             /** @var ProductVariant $productVariant */
  468.             foreach ($this->getProductVariants() as $productVariant)
  469.             {
  470.                 if ($productVariant->getMasterProduct()->getEventPlaceName())
  471.                 {
  472.                     return $productVariant->getMasterProduct()->getEventPlaceName();
  473.                 }
  474.             }
  475.         }
  476.         return null;
  477.     }
  478.     public function getEventPlaceDesc()
  479.     {
  480.         if (!$this->getProducts()->isEmpty())
  481.         {
  482.             /** @var Product $product */
  483.             foreach ($this->getProducts() as $product)
  484.             {
  485.                 if ($product->getEventPlaceDesc())
  486.                 {
  487.                     return $product->getEventPlaceDesc();
  488.                 }
  489.             }
  490.         }
  491.         if (!$this->getProductVariants()->isEmpty())
  492.         {
  493.             /** @var ProductVariant $productVariant */
  494.             foreach ($this->getProductVariants() as $productVariant)
  495.             {
  496.                 if ($productVariant->getMasterProduct()->getEventPlaceDesc())
  497.                 {
  498.                     return $productVariant->getMasterProduct()->getEventPlaceDesc();
  499.                 }
  500.             }
  501.         }
  502.         return null;
  503.     }
  504.     public function countTickets()
  505.     {
  506.         $event false;
  507.         foreach ($this->getProducts() as $product)
  508.         {
  509.             if ($product->getIsEvent()) $event true;
  510.         }
  511.         if (!$event) return false;
  512.         if (!empty($this->getDefaultQuantityTicket()))
  513.         {
  514.             return $this->getDefaultQuantityTicket();
  515.         }
  516.         $result 0;
  517.         foreach ($this->getProducts() as $product)
  518.         {
  519.             foreach ($product->getProductVariant() as $productVariant)
  520.             {
  521.                 if ($productVariant->getQuantity())
  522.                 {
  523.                     $result += $productVariant->getQuantity() - $productVariant->getOrderQuantity();
  524.                 }
  525.             }
  526.         }
  527.         return max($result0);
  528.     }
  529.     /** @ORM\PreUpdate() */
  530.     public function preUpdate()
  531.     {
  532.         $this->updatedAt = new \DateTime();
  533.     }
  534.     public function __construct()
  535.     {
  536.         $this->products                         = new ArrayCollection();
  537.         $this->productImages                    = new ArrayCollection();
  538.         $this->productMovies                    = new ArrayCollection();
  539.         $this->tmplModuleContents               = new ArrayCollection();
  540.         $this->productTypeDetailDescriptions    = new ArrayCollection();
  541.         $this->productRelease                   = new ArrayCollection();
  542.         $this->categories                       = new ArrayCollection();
  543.         $this->productVariants                  = new ArrayCollection();
  544.         $this->productCart = new ArrayCollection();
  545.     }
  546.     public function setCouponDefault(?Coupon $couponDefault): self
  547.     {
  548.         $this->couponDefault $couponDefault;
  549.         return $this;
  550.     }
  551.     public function getCouponDefault(): ?Coupon
  552.     {
  553.         if (
  554.             !empty($this->couponDefault)
  555.             && !empty($this->couponDefault->getCouponType())
  556.             &&
  557.             (
  558.                 $this->couponDefault->getCouponType()->getId() == 1
  559.                 || $this->couponDefault->getCouponType()->getId() == 2
  560.             )
  561.         )
  562.         {
  563.             return $this->couponDefault;
  564.         }
  565.         return null;
  566.     }
  567.     public function setPartnerLogoFile(File $partnerLogoFile null)
  568.     {
  569.         $this->partnerLogoFile $partnerLogoFile;
  570.         // VERY IMPORTANT:
  571.         // It is required that at least one field changes if you are using Doctrine,
  572.         // otherwise the event listeners won't be called and the file is lost
  573.         if ($partnerLogoFile)
  574.         {
  575.             // if 'updatedAt' is not defined in your entity, use another property
  576.             $this->updatedAt = new \DateTime('now');
  577.         }
  578.     }
  579.     public function getPartnerLogoFile()
  580.     {
  581.         return $this->partnerLogoFile;
  582.     }
  583.     public function setPartnerLogo($partnerLogo)
  584.     {
  585.         $this->partnerLogo $partnerLogo;
  586.     }
  587.     public function getPartnerLogo()
  588.     {
  589.         return $this->partnerLogo;
  590.     }
  591.     public function setLogoFile(File $logoFile null)
  592.     {
  593.         $this->logoFile $logoFile;
  594.         // VERY IMPORTANT:
  595.         // It is required that at least one field changes if you are using Doctrine,
  596.         // otherwise the event listeners won't be called and the file is lost
  597.         if ($logoFile)
  598.         {
  599.             // if 'updatedAt' is not defined in your entity, use another property
  600.             $this->updatedAt = new \DateTime('now');
  601.         }
  602.     }
  603.     public function getLogoFile()
  604.     {
  605.         return $this->logoFile;
  606.     }
  607.     public function setLogo($logo)
  608.     {
  609.         $this->logo $logo;
  610.     }
  611.     public function getLogo()
  612.     {
  613.         return $this->logo;
  614.     }
  615.     public function setPreviewFragmentFile(File $file null)
  616.     {
  617.         $this->previewFragmentFile $file;
  618.         // VERY IMPORTANT:
  619.         // It is required that at least one field changes if you are using Doctrine,
  620.         // otherwise the event listeners won't be called and the file is lost
  621.         if ($file)
  622.         {
  623.             // if 'updatedAt' is not defined in your entity, use another property
  624.             $this->updatedAt = new \DateTime('now');
  625.         }
  626.     }
  627.     public function getPreviewFragmentFile()
  628.     {
  629.         return $this->previewFragmentFile;
  630.     }
  631.     public function setPreviewFragment($fileName)
  632.     {
  633.         $this->previewFragment $fileName;
  634.     }
  635.     public function getPreviewFragment()
  636.     {
  637.         return $this->previewFragment;
  638.     }
  639.     public function getId(): ?int
  640.     {
  641.         return $this->id;
  642.     }
  643.     /**
  644.      * @return Collection
  645.      */
  646.     public function getProducts(): Collection
  647.     {
  648.         return $this->products;
  649.     }
  650.     /**
  651.      * @param Product $product
  652.      * @return ProductAssociation
  653.      */
  654.     public function addProduct(Product $product): self
  655.     {
  656.         if (!$this->products->contains($product)) {
  657.             $this->products[] = $product;
  658.             $product->addProductAssociation($this);
  659.         }
  660.         return $this;
  661.     }
  662.     /**
  663.      * @param ProductVariant $productVariant
  664.      * @return ProductAssociation
  665.      */
  666.     public function removeProduct(Product $product): self
  667.     {
  668.         if ($this->products->contains($product)) {
  669.             $this->products->removeElement($product);
  670.             $product->removeProductAssociation($this);
  671.         }
  672.         return $this;
  673.     }
  674.     /**
  675.      * @return Collection
  676.      */
  677.     public function getProductVariants(): Collection
  678.     {
  679.         return $this->productVariants;
  680.     }
  681.     /**
  682.      * @param ProductVariant $productVariant
  683.      * @return ProductAssociation
  684.      */
  685.     public function addProductVariant(ProductVariant $productVariant): self
  686.     {
  687.         if (!$this->productVariants->contains($productVariant)) {
  688.             $this->productVariants[] = $productVariant;
  689.             $productVariant->addProductAssociation($this);
  690.         }
  691.         return $this;
  692.     }
  693.     /**
  694.      * @param ProductVariant $productVariant
  695.      * @return ProductAssociation
  696.      */
  697.     public function removeProductVariant(ProductVariant $productVariant): self
  698.     {
  699.         if ($this->productVariants->contains($productVariant)) {
  700.             $this->productVariants->removeElement($productVariant);
  701.             $productVariant->removeProductAssociation($this);
  702.         }
  703.         return $this;
  704.     }
  705.     public function getUpdatedAt(): ?\DateTimeInterface
  706.     {
  707.         return $this->updatedAt;
  708.     }
  709.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  710.     {
  711.         $this->updatedAt $updatedAt;
  712.         return $this;
  713.     }
  714.     public function getTitle(): ?string
  715.     {
  716.         return $this->title;
  717.     }
  718.     public function setTitle(?string $title): self
  719.     {
  720.         $this->title $title;
  721.         return $this;
  722.     }
  723.     public function getSlug(): ?string
  724.     {
  725.         return $this->slug;
  726.     }
  727.     public function setSlug(?string $slug): self
  728.     {
  729.         $this->slug $slug;
  730.         return $this;
  731.     }
  732.     public function getSubtitle(): ?string
  733.     {
  734.         return $this->subtitle;
  735.     }
  736.     public function setSubtitle(?string $subtitle): self
  737.     {
  738.         $this->subtitle $subtitle;
  739.         return $this;
  740.     }
  741.     public function getFrontendDescription(): ?string
  742.     {
  743.         return $this->frontendDescription;
  744.     }
  745.     public function setFrontendDescription(?string $frontendDescription): self
  746.     {
  747.         $this->frontendDescription $frontendDescription;
  748.         return $this;
  749.     }
  750.     public function getFrontendDescriptionShort(): ?string
  751.     {
  752.         return $this->frontendDescriptionShort;
  753.     }
  754.     public function setFrontendDescriptionShort(?string $frontendDescriptionShort): self
  755.     {
  756.         $this->frontendDescriptionShort $frontendDescriptionShort;
  757.         return $this;
  758.     }
  759.     public function getIsRecommended(): ?bool
  760.     {
  761.         return $this->isRecommended;
  762.     }
  763.     public function setIsRecommended(bool $isRecommended): self
  764.     {
  765.         $this->isRecommended $isRecommended;
  766.         return $this;
  767.     }
  768.     public function getIsMostBought(): ?bool
  769.     {
  770.         return $this->isMostBought;
  771.     }
  772.     public function setIsMostBought(bool $isMostBought): self
  773.     {
  774.         $this->isMostBought $isMostBought;
  775.         return $this;
  776.     }
  777.     public function getDefaultQuantityTicket(): ?int
  778.     {
  779.         return $this->defaultQuantityTicket;
  780.     }
  781.     public function setDefaultQuantityTicket(?int $defaultQuantityTicket): self
  782.     {
  783.         $this->defaultQuantityTicket $defaultQuantityTicket;
  784.         return $this;
  785.     }
  786.     public function getCustomScripts(): ?string
  787.     {
  788.         return $this->customScripts;
  789.     }
  790.     public function setCustomScripts(?string $customScripts): self
  791.     {
  792.         $this->customScripts $customScripts;
  793.         return $this;
  794.     }
  795.     /**
  796.      * @return Collection|ProductImage[]
  797.      */
  798.     public function getProductImages(): Collection
  799.     {
  800.         return $this->productImages;
  801.     }
  802.     public function addProductImage(ProductImage $productImage): self
  803.     {
  804.         if (!$this->productImages->contains($productImage)) {
  805.             $this->productImages[] = $productImage;
  806.             $productImage->setProductAssociation($this);
  807.         }
  808.         return $this;
  809.     }
  810.     public function removeProductImage(ProductImage $productImage): self
  811.     {
  812.         if ($this->productImages->contains($productImage)) {
  813.             $this->productImages->removeElement($productImage);
  814.             // set the owning side to null (unless already changed)
  815.             if ($productImage->getProductAssociation() === $this) {
  816.                 $productImage->setProductAssociation(null);
  817.             }
  818.         }
  819.         return $this;
  820.     }
  821.     /**
  822.      * @return Collection|ProductMovie[]
  823.      */
  824.     public function getProductMovies(): Collection
  825.     {
  826.         return $this->productMovies;
  827.     }
  828.     public function addProductMovie(ProductMovie $productMovie): self
  829.     {
  830.         if (!$this->productMovies->contains($productMovie)) {
  831.             $this->productMovies[] = $productMovie;
  832.             $productMovie->setProductAssociation($this);
  833.         }
  834.         return $this;
  835.     }
  836.     public function removeProductMovie(ProductMovie $productMovie): self
  837.     {
  838.         if ($this->productMovies->contains($productMovie)) {
  839.             $this->productMovies->removeElement($productMovie);
  840.             // set the owning side to null (unless already changed)
  841.             if ($productMovie->getProductAssociation() === $this) {
  842.                 $productMovie->setProductAssociation(null);
  843.             }
  844.         }
  845.         return $this;
  846.     }
  847.     public function getPortalSettings(): ?PortalSettings
  848.     {
  849.         return $this->portalSettings;
  850.     }
  851.     public function setPortalSettings(?PortalSettings $portalSettings): self
  852.     {
  853.         $this->portalSettings $portalSettings;
  854.         return $this;
  855.     }
  856.     public function getRecommendedByCategory(): ?Category
  857.     {
  858.         return $this->recommendedByCategory;
  859.     }
  860.     public function setRecommendedByCategory(?Category $recommendedByCategory): self
  861.     {
  862.         $this->recommendedByCategory $recommendedByCategory;
  863.         // set (or unset) the owning side of the relation if necessary
  864.         $newRecommendedProductAssociation $recommendedByCategory === null null $this;
  865.         if ($newRecommendedProductAssociation !== $recommendedByCategory->getRecommendedProductAssociation()) {
  866.             $recommendedByCategory->setRecommendedProductAssociation($newRecommendedProductAssociation);
  867.         }
  868.         return $this;
  869.     }
  870.     public function getTemplate(): ?Template
  871.     {
  872.         return $this->template;
  873.     }
  874.     public function setTemplate(?Template $template): self
  875.     {
  876.         $this->template $template;
  877.         // set (or unset) the owning side of the relation if necessary
  878.         $newProductAssociation $template === null null $this;
  879.         if ($newProductAssociation !== $template->getProductAssociation()) {
  880.             $template->setProductAssociation($newProductAssociation);
  881.         }
  882.         return $this;
  883.     }
  884.     /**
  885.      * @return Collection|TmplModuleContent[]
  886.      */
  887.     public function getTmplModuleContents(): Collection
  888.     {
  889.         return $this->tmplModuleContents;
  890.     }
  891.     public function addTmplModuleContent(TmplModuleContent $tmplModuleContent): self
  892.     {
  893.         if (!$this->tmplModuleContents->contains($tmplModuleContent)) {
  894.             $this->tmplModuleContents[] = $tmplModuleContent;
  895.             $tmplModuleContent->setProductAssociation($this);
  896.         }
  897.         return $this;
  898.     }
  899.     public function removeTmplModuleContent(TmplModuleContent $tmplModuleContent): self
  900.     {
  901.         if ($this->tmplModuleContents->contains($tmplModuleContent)) {
  902.             $this->tmplModuleContents->removeElement($tmplModuleContent);
  903.             // set the owning side to null (unless already changed)
  904.             if ($tmplModuleContent->getProductAssociation() === $this) {
  905.                 $tmplModuleContent->setProductAssociation(null);
  906.             }
  907.         }
  908.         return $this;
  909.     }
  910.     public function getProductMainType(): ?ProductMainType
  911.     {
  912.         return $this->productMainType;
  913.     }
  914.     public function setProductMainType(?ProductMainType $productMainType): self
  915.     {
  916.         $this->productMainType $productMainType;
  917.         return $this;
  918.     }
  919.     /**
  920.      * @return Collection|ProductTypeDetailDescription[]
  921.      */
  922.     public function getProductTypeDetailDescriptions(): Collection
  923.     {
  924.         return $this->productTypeDetailDescriptions;
  925.     }
  926.     public function addProductTypeDetailDescription(ProductTypeDetailDescription $productTypeDetailDescription): self
  927.     {
  928.         if (!$this->productTypeDetailDescriptions->contains($productTypeDetailDescription)) {
  929.             $this->productTypeDetailDescriptions[] = $productTypeDetailDescription;
  930.             $productTypeDetailDescription->setProductAssociation($this);
  931.         }
  932.         return $this;
  933.     }
  934.     public function removeProductTypeDetailDescription(ProductTypeDetailDescription $productTypeDetailDescription): self
  935.     {
  936.         if ($this->productTypeDetailDescriptions->contains($productTypeDetailDescription)) {
  937.             $this->productTypeDetailDescriptions->removeElement($productTypeDetailDescription);
  938.             // set the owning side to null (unless already changed)
  939.             if ($productTypeDetailDescription->getProductAssociation() === $this) {
  940.                 $productTypeDetailDescription->setProductAssociation(null);
  941.             }
  942.         }
  943.         return $this;
  944.     }
  945.     public function setProductTypeDetailDescriptions(ArrayCollection $productTypeDetailDescriptions): self
  946.     {
  947.         $this->productTypeDetailDescriptions $productTypeDetailDescriptions;
  948.         return $this;
  949.     }
  950.     /**
  951.      * @return Collection|ProductRelease[]
  952.      */
  953.     public function getProductRelease(): Collection
  954.     {
  955.         return $this->productRelease;
  956.     }
  957.     public function addProductRelease(ProductRelease $productRelease): self
  958.     {
  959.         if (!$this->productRelease->contains($productRelease)) {
  960.             $this->productRelease[] = $productRelease;
  961.             $productRelease->setProductAssociation($this);
  962.         }
  963.         return $this;
  964.     }
  965.     public function removeProductRelease(ProductRelease $productRelease): self
  966.     {
  967.         if ($this->productRelease->contains($productRelease)) {
  968.             $this->productRelease->removeElement($productRelease);
  969.             // set the owning side to null (unless already changed)
  970.             if ($productRelease->getProductAssociation() === $this) {
  971.                 $productRelease->setProductAssociation(null);
  972.             }
  973.         }
  974.         return $this;
  975.     }
  976.     public function getMetaTags(): ?MetaTags
  977.     {
  978.         return $this->metaTags;
  979.     }
  980.     public function setMetaTags(?MetaTags $metaTags): self
  981.     {
  982.         $this->metaTags $metaTags;
  983.         // set (or unset) the owning side of the relation if necessary
  984.         $newProductAssociation $metaTags === null null $this;
  985.         if ($newProductAssociation !== $metaTags->getProductAssociation()) {
  986.             $metaTags->setProductAssociation($newProductAssociation);
  987.         }
  988.         return $this;
  989.     }
  990.     public function getCategoryMaster(): ?Category
  991.     {
  992.         return $this->categoryMaster;
  993.     }
  994.     public function setCategoryMaster(?Category $categoryMaster): self
  995.     {
  996.         $this->categoryMaster $categoryMaster;
  997.         return $this;
  998.     }
  999.     /**
  1000.      * @return Collection|Category[]
  1001.      */
  1002.     public function getCategories(): Collection
  1003.     {
  1004.         return $this->categories;
  1005.     }
  1006.     public function addCategory(Category $category): self
  1007.     {
  1008.         if (!$this->categories->contains($category)) {
  1009.             $this->categories[] = $category;
  1010.             $category->addProductAssociation($this);
  1011.         }
  1012.         return $this;
  1013.     }
  1014.     public function removeCategory(Category $category): self
  1015.     {
  1016.         if ($this->categories->contains($category)) {
  1017.             $this->categories->removeElement($category);
  1018.             $category->removeProductAssociation($this);
  1019.         }
  1020.         return $this;
  1021.     }
  1022.     public function getIsHidden(): bool
  1023.     {
  1024.         return $this->isHidden;
  1025.     }
  1026.     public function setIsHidden(bool $isHidden): self
  1027.     {
  1028.         $this->isHidden $isHidden;
  1029.         return $this;
  1030.     }
  1031.     /**
  1032.      * @return Collection|ProductCart[]
  1033.      */
  1034.     public function getProductCart(): Collection
  1035.     {
  1036.         return $this->productCart;
  1037.     }
  1038.     public function addProductCart(ProductCart $productCart): self
  1039.     {
  1040.         if (!$this->productCart->contains($productCart)) {
  1041.             $this->productCart[] = $productCart;
  1042.             $productCart->setProductAssociation($this);
  1043.         }
  1044.         return $this;
  1045.     }
  1046.     public function removeProductCart(ProductCart $productCart): self
  1047.     {
  1048.         if ($this->productCart->contains($productCart)) {
  1049.             $this->productCart->removeElement($productCart);
  1050.             // set the owning side to null (unless already changed)
  1051.             if ($productCart->getProductVariant() === $this) {
  1052.                 $productCart->setProductAssociation(null);
  1053.             }
  1054.         }
  1055.         return $this;
  1056.     }
  1057.     public function getBackground(): ?string
  1058.     {
  1059.         return $this->background;
  1060.     }
  1061.     public function setBackground(?string $background): self
  1062.     {
  1063.         $this->background $background;
  1064.         return $this;
  1065.     }
  1066.     public function setBackgroundFile(File $backgroundFile null)
  1067.     {
  1068.         $this->backgroundFile $backgroundFile;
  1069.         // VERY IMPORTANT:
  1070.         // It is required that at least one field changes if you are using Doctrine,
  1071.         // otherwise the event listeners won't be called and the file is lost
  1072.         if ($backgroundFile)
  1073.         {
  1074.             // if 'updatedAt' is not defined in your entity, use another property
  1075.             $this->updatedAt = new \DateTime('now');
  1076.         }
  1077.     }
  1078.     public function getBackgroundFile()
  1079.     {
  1080.         return $this->backgroundFile;
  1081.     }
  1082.     public function getNumberOfAccessToLastReleases(): ?int
  1083.     {
  1084.         return $this->numberOfAccessToLastReleases;
  1085.     }
  1086.     public function setNumberOfAccessToLastReleases(?int $numberOfAccessToLastReleases): self
  1087.     {
  1088.         $this->numberOfAccessToLastReleases $numberOfAccessToLastReleases;
  1089.         return $this;
  1090.     }
  1091.     public function hasCycles(): bool
  1092.     {
  1093.         foreach ($this->getProducts() as $product)
  1094.         {
  1095.             if ($product->getProductType() && $product->getProductType()->hasCycles())
  1096.             {
  1097.                 return true;
  1098.             }
  1099.         }
  1100.         return false;
  1101.     }
  1102.     public function getUseHtmlLanding(): ?bool
  1103.     {
  1104.         return $this->useHtmlLanding;
  1105.     }
  1106.     public function setUseHtmlLanding(bool $useHtmlLanding): self
  1107.     {
  1108.         $this->useHtmlLanding $useHtmlLanding;
  1109.         return $this;
  1110.     }
  1111.     public function getCustomHead(): ?string
  1112.     {
  1113.         return $this->customHead;
  1114.     }
  1115.     public function setCustomHead(?string $customHead): self
  1116.     {
  1117.         $this->customHead $customHead;
  1118.         return $this;
  1119.     }
  1120.     public function getCustomCss(): ?string
  1121.     {
  1122.         return $this->customCss;
  1123.     }
  1124.     public function setCustomCss(?string $customCss): self
  1125.     {
  1126.         $this->customCss $customCss;
  1127.         return $this;
  1128.     }
  1129.     public function getCustomLanding(): ?string
  1130.     {
  1131.         return $this->customLanding;
  1132.     }
  1133.     public function setCustomLanding(?string $customLanding): self
  1134.     {
  1135.         $this->customLanding $customLanding;
  1136.         return $this;
  1137.     }
  1138.     public function getLandingFullWidth(): ?bool
  1139.     {
  1140.         return $this->landingFullWidth;
  1141.     }
  1142.     public function setLandingFullWidth(?bool $landingFullWidth): self
  1143.     {
  1144.         $this->landingFullWidth $landingFullWidth;
  1145.         return $this;
  1146.     }
  1147. }