src/Entity/Product.php line 33

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface;
  4. use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait;
  5. use Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait;
  6. use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
  7. use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait;
  8. use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;
  9. use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
  10. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  11. use App\Model\LangParamInterface;
  12. use App\Model\LangParamRelationInterface;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Doctrine\Common\Collections\Collection;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use Doctrine\ORM\Query\Parameter;
  17. use phpDocumentor\Reflection\Types\Self_;
  18. use Symfony\Component\Validator\Constraints as Assert;
  19. use Symfony\Component\HttpFoundation\File\UploadedFile;
  20. use Symfony\Component\HttpFoundation\File\File;
  21. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  22. /**
  23.  * @ORM\Entity
  24.  * @ORM\Table(name="product")
  25.  */
  26. class Product implements TranslatableInterfaceLangParamInterfaceBlameableInterfaceTimestampableInterfaceSoftDeletableInterface {
  27.     use BlameableTrait;
  28.     use TimestampableTrait;
  29.     use TranslatableTrait;
  30.     use SoftDeletableTrait;
  31.     const SMALL_PRODUCT_PHOTO 'smallProductPhoto';
  32.     const SMALL_PRODUCT_TEXTILE 'smallProductTextile';
  33.     const SHIPPING_CATEGORY_A 'shipping_category_a';
  34.     const SHIPPING_CATEGORY_B 'shipping_category_b';
  35.     /**
  36.      *
  37.      * Small product -> to show textiles or standard gallery product?
  38.      *
  39.      * @param $translator
  40.      * @return array
  41.      */
  42.     static public function getSmallProductOptions($translator$locale) {
  43.         return [
  44.             $translator->trans(self::SMALL_PRODUCT_PHOTO, [], 'admin'$locale) => self::SMALL_PRODUCT_PHOTO,
  45.             $translator->trans(self::SMALL_PRODUCT_TEXTILE, [], 'admin'$locale) => self::SMALL_PRODUCT_TEXTILE,
  46.         ];
  47.     }
  48.     static public function getShippingCategories($translator$locale) {
  49.         return [
  50.             $translator->trans(self::SHIPPING_CATEGORY_A, [], 'admin'$locale) => self::SHIPPING_CATEGORY_A,
  51.             $translator->trans(self::SHIPPING_CATEGORY_B, [], 'admin'$locale) => self::SHIPPING_CATEGORY_B,
  52.         ];
  53.     }
  54.     /**
  55.      * @ORM\Id
  56.      * @ORM\Column(type="integer")
  57.      * @ORM\GeneratedValue(strategy="AUTO")
  58.      */
  59.     protected $id;
  60.     /**
  61.      * Obsługa tłumaczeń
  62.      * @param $method
  63.      * @param $arguments
  64.      * @return mixed
  65.      */
  66.     public function __call($method$arguments)
  67.     {
  68.         return $this->proxyCurrentLocaleTranslation($method$arguments);
  69.     }
  70.     public function getName()
  71.     {
  72.         return $this->translate()->getName();
  73.     }
  74.     public function getDescription()
  75.     {
  76.         return $this->translate()->getDescription();
  77.     }
  78.     public function getPhoto3dGalleryUrl()
  79.     {
  80.         return $this->translate()->getPhoto3dGalleryUrl();
  81.     }
  82.     public function getYoutubeGalleryUrl()
  83.     {
  84.         return $this->translate()->getYoutubeGalleryUrl();
  85.     }
  86.     public function getMetaDescription()
  87.     {
  88.         return $this->translate()->getMetaDescription();
  89.     }
  90.     public function getMetaTitle()
  91.     {
  92.         return $this->translate()->getMetaTitle();
  93.     }
  94.     public function getMetaKeywords()
  95.     {
  96.         return $this->translate()->getMetaKeywords();
  97.     }
  98.     public function getSlug()
  99.     {
  100.         if ($this->translate()->getSlug()) {
  101.             return $this->translate()->getSlug();
  102.         } else {
  103.             return 'product';
  104.         }
  105.     }
  106.     public function getShortDescription()
  107.     {
  108.         return $this->translate()->getShortDescription();
  109.     }
  110.     public function getPhoto3dAdditional()
  111.     {
  112.         return $this->translate()->getPhoto3dAdditional();
  113.     }
  114.     public function getDetails()
  115.     {
  116.         return $this->translate()->getDetails();
  117.     }
  118.     public function getTransFilm()
  119.     {
  120.         return $this->translate()->getTransFilm();
  121.     }
  122.     public function getDescriptionFb() {
  123.         $description_facebook $this->getDescription();
  124.         $description_facebook strip_tags($description_facebook);
  125.         $description_facebook preg_replace'/\s+/'' '$description_facebook);
  126.         $description_facebook str_replace("&amp;oacute;""ó"$description_facebook);
  127.         $description_facebook str_replace("&nbsp;"" "$description_facebook);
  128.         $description_facebook str_replace("&amp;oacute;""ó"$description_facebook);
  129.         return $description_facebook;
  130.     }
  131.     /**
  132.      * @var string
  133.      *
  134.      * @ORM\Column(name="symbol", type="string", length=255, nullable=true)
  135.      */
  136.     private $symbol;
  137.     /**
  138.      * @var string
  139.      *
  140.      * @ORM\Column(name="photo3d", type="text", nullable=true)
  141.      */
  142.     private $photo3d;
  143.     /**
  144.      * @ORM\ManyToOne(targetEntity="App\Entity\ProductFamily", cascade={"all"})
  145.      * @ORM\JoinColumn(name="product_family_id", referencedColumnName="id", onDelete="CASCADE")
  146.      */
  147.     protected $productFamily;
  148.     /**
  149.      * @ORM\ManyToOne(targetEntity="App\Entity\ProductProducer", cascade={"all"})
  150.      * @ORM\JoinColumn(name="product_producer_id", referencedColumnName="id", onDelete="CASCADE")
  151.      */
  152.     protected $productProducer;
  153.     /**
  154.      * @Doctrine\ORM\Mapping\ManyToMany(targetEntity="App\Entity\Marker", inversedBy="products")
  155.      * @Doctrine\ORM\Mapping\JoinTable(name="product_markers")
  156.      */
  157.     private $markers;
  158.     /**
  159.      * @Doctrine\ORM\Mapping\ManyToMany(targetEntity="App\Entity\ProductColor", inversedBy="products")
  160.      * @Doctrine\ORM\Mapping\JoinTable(name="product_product_color")
  161.      */
  162.     private $colors;
  163.     /**
  164.      * @Doctrine\ORM\Mapping\ManyToMany(targetEntity="App\Entity\ListingMarker", inversedBy="products")
  165.      * @Doctrine\ORM\Mapping\JoinTable(name="listing_markers")
  166.      */
  167.     private $listingMarkers;
  168.     /**
  169.      * @Doctrine\ORM\Mapping\ManyToMany(targetEntity="App\Entity\ProductEquipment")
  170.      * @Doctrine\ORM\Mapping\JoinTable(name="product_equipment_relation")
  171.      */
  172.     private $equipments;
  173.     /**
  174.      * @Doctrine\ORM\Mapping\ManyToMany(targetEntity="App\Entity\DeliveryMethod")
  175.      * @Doctrine\ORM\Mapping\JoinTable(name="product_special_delivery_methods")
  176.      */
  177.     private $specialDeliveryMethods;
  178.     /**
  179.      * @ORM\ManyToOne(targetEntity="App\Entity\Availability", cascade={"all"}, inversedBy="products")
  180.      * @ORM\JoinColumn(name="availability_id", referencedColumnName="id", onDelete="CASCADE")
  181.      */
  182.     protected $availability;
  183.     /**
  184.      * @ORM\ManyToOne(targetEntity="App\Entity\Category", cascade={"all"})
  185.      * @ORM\JoinColumn(name="main_category_id", referencedColumnName="id")
  186.      */
  187.     protected $mainCategory;
  188.     /**
  189.      * @ORM\OneToMany(targetEntity="App\Entity\ProductComment", mappedBy="products", cascade={"persist"})
  190.      */
  191.     protected $comments;
  192.     /**
  193.      * @ORM\OneToMany(targetEntity="App\Entity\SubProduct", mappedBy="product", cascade={"persist"})
  194.      */
  195.     protected $subProducts;
  196.     /**
  197.      * @ORM\OneToMany(targetEntity="App\Entity\ProductFilter", mappedBy="product", cascade={"persist"})
  198.      */
  199.     protected $filters;
  200.     /**
  201.      * @Doctrine\ORM\Mapping\OneToMany(targetEntity="App\Entity\ProductPrice", mappedBy="product", cascade={"persist"})
  202.      */
  203.     protected $productPrices;
  204.     /**
  205.      * @Doctrine\ORM\Mapping\OneToMany(targetEntity="App\Entity\ProductPriceChangeLog", mappedBy="product", cascade={"persist"})
  206.      */
  207.     protected $productPriceChangeLog;
  208.     /**
  209.      * @Doctrine\ORM\Mapping\OneToMany(targetEntity="App\Entity\ProductPriceDraft", mappedBy="product", cascade={"persist"})
  210.      */
  211.     protected $productPriceDrafts;
  212.  
  213.     /**
  214.      * @Doctrine\ORM\Mapping\OneToMany(targetEntity="App\Entity\ProductXml", mappedBy="product", cascade={"persist"})
  215.      */
  216.     protected $productXml;
  217.     /**
  218.      * @Doctrine\ORM\Mapping\OneToMany(targetEntity="App\Entity\CompareParameterValue", mappedBy="product", cascade={"persist"})
  219.      * @ORM\OrderBy({"parameter" = "ASC"})
  220.      */
  221.     protected $compareValues;
  222.     /**
  223.      * @Doctrine\ORM\Mapping\OneToMany(targetEntity="App\Entity\ProductFurnitureType", mappedBy="product", cascade={"persist"})
  224.      */
  225.     protected $furnitureTypes;
  226.     /**
  227.      * @Doctrine\ORM\Mapping\OneToMany(targetEntity="App\Entity\ProductPhoto", mappedBy="product", orphanRemoval=true)
  228.      * @ORM\OrderBy({"position" = "ASC"})
  229.      */
  230.     protected $photos;
  231.     /**
  232.      * @ORM\OneToMany(targetEntity="App\Entity\ProductCategory", mappedBy="product", cascade={"persist"})
  233.      */
  234.     protected $categories;
  235.     /**
  236.      * @ORM\OneToMany(targetEntity="App\Entity\ProductRecommendation", mappedBy="product", cascade={"persist"})
  237.      */
  238.     protected $recommendations;
  239.     /**
  240.      * @ORM\OneToMany(targetEntity="App\Entity\ProductSimilarColors", mappedBy="product", cascade={"persist"})
  241.      */
  242.     protected $similarColors;
  243.     /**
  244.      * @ORM\OneToMany(targetEntity="App\Entity\ProductCrossSelling", mappedBy="product", cascade={"persist"})
  245.      */
  246.     protected $crossSelling;
  247.     /**
  248.      * @ORM\OneToMany(targetEntity="App\Entity\ProductLangParam", mappedBy="product", cascade={"all"})
  249.      */
  250.     protected $langParams;
  251.     /**
  252.      * @Doctrine\ORM\Mapping\Column(name="is_variants", type="boolean", options={"default"=0}, nullable=true)
  253.      */
  254.     protected $isVariants;
  255.     /**
  256.      * @Doctrine\ORM\Mapping\Column(name="is_palette_delivery", type="boolean", options={"default"=0}, nullable=true)
  257.      */
  258.     protected $isPaletteDelivery;
  259.     /**
  260.      * @Doctrine\ORM\Mapping\Column(name="payu", type="boolean", options={"default"=0}, nullable=true)
  261.      */
  262.     protected $payu;
  263.     /**
  264.      * @Doctrine\ORM\Mapping\Column(name="automatic_price", type="boolean", options={"default"=1}, nullable=true)
  265.      */
  266.     protected $automaticPrice true;
  267.     /**
  268.      * @Doctrine\ORM\Mapping\Column(name="halmar_stock_exchange", type="boolean", options={"default"=0}, nullable=true)
  269.      */
  270.     protected $halmarStockExchange;
  271.     /**
  272.      * @Doctrine\ORM\Mapping\Column(name="diablo_stock_exchange", type="boolean", options={"default"=1}, nullable=true)
  273.      */
  274.     protected $diabloStockExchange true;
  275.     /**
  276.      * @Doctrine\ORM\Mapping\Column(name="jan_nowak_stock_exchange", type="boolean", options={"default"=1}, nullable=true)
  277.      */
  278.     protected $janNowakStockExchange true;
  279.     /**
  280.      * @Doctrine\ORM\Mapping\Column(name="actona_stock_exchange", type="boolean", options={"default"=1}, nullable=true)
  281.      */
  282.     protected $actonaStockExchange true;
  283.     /**
  284.      * @Doctrine\ORM\Mapping\Column(name="unique_stock_exchange", type="boolean", options={"default"=1}, nullable=true)
  285.      */
  286.     protected $uniqueStockExchange true;
  287.     /**
  288.      * @Doctrine\ORM\Mapping\Column(name="signal_stock_exchange", type="boolean", options={"default"=1}, nullable=true)
  289.      */
  290.     protected $signalStockExchange true;
  291.     /**
  292.      * @Doctrine\ORM\Mapping\Column(name="is_compare", type="boolean", options={"default"=0}, nullable=true)
  293.      */
  294.     protected $isCompare;
  295.     /**
  296.      * @var string
  297.      *
  298.      * @ORM\Column(name="priority_search_engine", type="integer", length=255, nullable=true)
  299.      */
  300.     private $prioritySearchEngine;
  301.     /**
  302.      * @Doctrine\ORM\Mapping\Column(name="is_negotiate", type="boolean", options={"default"=0}, nullable=true)
  303.      */
  304.     protected $isNegotiate;
  305.     /**
  306.      * @Doctrine\ORM\Mapping\Column(name="is_rebate_code", type="boolean", options={"default"=0}, nullable=true)
  307.      */
  308.     protected $isRebateCode;
  309.     /**
  310.      * @Doctrine\ORM\Mapping\Column(name="old_price", type="decimal", precision=10, scale=2, nullable=true)
  311.      */
  312.     protected $oldPrice;
  313.     /**
  314.      * DEPRECIATED - Wyłączone pole, nie używane po zmianach (film jako translatable)
  315.      * @Doctrine\ORM\Mapping\Column(name="film", type="text", nullable=true)
  316.      */
  317.     protected $film;
  318.     /**
  319.      * @Doctrine\ORM\Mapping\Column(name="small_product_photo", type="string", nullable=true)
  320.      */
  321.     protected $smallProductPhoto;
  322.     /**
  323.      * @var string
  324.      *
  325.      * @ORM\Column(name="max_quantity", type="integer", length=255, nullable=true)
  326.      */
  327.     private $maxQuantity;
  328.     /**
  329.      * @Doctrine\ORM\Mapping\ManyToMany(targetEntity="App\Entity\LandingPage", mappedBy="products")
  330.      */
  331.     private $landingPages;
  332.     /**
  333.      * @var string
  334.      *
  335.      * @ORM\Column(name="listingMarkersIds", type="text", length=255, nullable=true)
  336.      */
  337.     private $listingMarkersIds;
  338.     /**
  339.      * @Doctrine\ORM\Mapping\Column(name="temporary_unavailable", type="boolean", options={"default"=0}, nullable=true)
  340.      */
  341.     protected $temporaryUnavailable;
  342.     /**
  343.      * Cross selling - skrypt liczący ranking do wyświetlania produktów "inni kupili również"
  344.      * @var \DateTime
  345.      *
  346.      * @ORM\Column(name="last_ranking_update", type="datetime", nullable=true)
  347.      */
  348.     private $lastRankingUpdate;
  349.     /**
  350.      * @var int
  351.      *
  352.      * @ORM\Column(name="height", type="integer", length=10, nullable=true)
  353.      */
  354.     private $height;
  355.     /**
  356.      * @var int
  357.      *
  358.      * @ORM\Column(name="width", type="integer", length=10, nullable=true)
  359.      */
  360.     private $width;
  361.     /**
  362.      * @var int
  363.      *
  364.      * @ORM\Column(name="depth", type="integer", length=10, nullable=true)
  365.      */
  366.     private $depth;
  367.     /**
  368.      * @Doctrine\ORM\Mapping\Column(name="shipping_category", type="string", nullable=true, options={"default"="shipping_category_a"})
  369.      */
  370.     protected $shippingCategory self::SHIPPING_CATEGORY_A;
  371.     public $promoPrices;
  372.     public function getProductPhotos(SubProduct $subProduct null) {
  373.         $col = new ArrayCollection();
  374.         if ($subProduct and $subProduct->getImageName()) {
  375.             $sub = new ProductPhoto();
  376.             $sub->setProduct($subProduct->getProduct());
  377.             $sub->setPosition(1);
  378.             $sub->setMain(1);
  379.             $sub->setImageName($subProduct->getImageName());
  380.             $col->add($sub);
  381.         }
  382.         foreach ($this->getPhotos() as $photo) {
  383.             $photo->setMain(0);
  384.             $col->add($photo);
  385.         }
  386.         return $col;
  387.     }
  388.     /**
  389.      * Constructor
  390.      */
  391.     public function __construct()
  392.     {
  393.         $this->shippingCategory self::SHIPPING_CATEGORY_A;
  394.         $this->colors = new \Doctrine\Common\Collections\ArrayCollection();
  395.         $this->comments = new \Doctrine\Common\Collections\ArrayCollection();
  396.         $this->productPrices = new \Doctrine\Common\Collections\ArrayCollection();
  397.         $this->photos = new \Doctrine\Common\Collections\ArrayCollection();
  398.         $this->categories = new \Doctrine\Common\Collections\ArrayCollection();
  399.         $this->recommendations = new ArrayCollection();
  400.         $this->furnitureTypes = new ArrayCollection();
  401.         $this->langParams = new ArrayCollection();
  402.         $this->compareValues = new ArrayCollection();
  403.         $this->filters = new ArrayCollection();
  404.         $this->smallProductPhoto self::SMALL_PRODUCT_PHOTO;
  405.         $this->markers = new ArrayCollection();
  406.         $this->equipments = new ArrayCollection();
  407.         $this->specialDeliveryMethods = new ArrayCollection();
  408.         $this->productXml = new ArrayCollection();
  409.         $this->landingPages = new ArrayCollection();
  410.         $this->listingMarkers = new ArrayCollection();
  411.         $this->subProducts = new ArrayCollection();
  412.         $this->productPriceDrafts = new ArrayCollection();
  413.         $this->productPriceChangeLog = new ArrayCollection();
  414.         $this->crossSelling = new ArrayCollection();
  415.         $this->promoPrices = [];
  416.         $this->similarColors = new ArrayCollection();
  417.     }
  418.     public function getActiveSubProducts() {
  419.         $s = new ArrayCollection();
  420.         foreach ($this->getSubProducts() as $subProduct) {
  421.             if ($subProduct->getActive()) {
  422.                 $s->add($subProduct);
  423.             }
  424.         }
  425.         return $s;
  426.     }
  427.     public function getLandingPagesMarkers() {
  428.         $markers = new ArrayCollection();
  429.         foreach ($this->getLandingPages() as $landingPage) {
  430.             if ($landingPage->getDeletedBy() === null and $landingPage->getVisible()) {
  431.                 /** @var $marker Marker */
  432.                 foreach ($landingPage->getMarkers() as $marker) {
  433.                     $markers->add($marker);
  434.                 }
  435.             }
  436.         }
  437.         return $markers;
  438.     }
  439.     public function getActiveLandingPages() {
  440.         $lp = new ArrayCollection();
  441.         foreach ($this->getLandingPages() as $landingPage) {
  442.             if ($landingPage->getDeletedBy() === null and $landingPage->getVisible()) {
  443.                 $lp->add($landingPage);
  444.             }
  445.         }
  446.         return $lp;
  447.     }
  448.     /**
  449.      * @return string
  450.      */
  451.     public function getMaxQuantity()
  452.     {
  453.         return $this->maxQuantity;
  454.     }
  455.     /**
  456.      * @param string $maxQuantity
  457.      */
  458.     public function setMaxQuantity($maxQuantity)
  459.     {
  460.         $this->maxQuantity $maxQuantity;
  461.     }
  462.     
  463.     /**
  464.      * @return mixed
  465.      */
  466.     public function getSmallProductPhoto()
  467.     {
  468.         return $this->smallProductPhoto;
  469.     }
  470.     /**
  471.      * @param mixed $smallProductPhoto
  472.      */
  473.     public function setSmallProductPhoto($smallProductPhoto): void
  474.     {
  475.         $this->smallProductPhoto $smallProductPhoto;
  476.     }
  477.     public function mainPhotoExists($locale 'pl') {
  478.         /** @var $photo ProductPhoto */
  479.         foreach ($this->getPhotos() as $photo) {
  480.             if ($photo->getMain()) {
  481.                 /** @var $language Language */
  482.                 foreach ($photo->getLanguages() as $language) {
  483.                     if ($language->getLocaleShort() == $locale) {
  484.                         return true;
  485.                     }
  486.                 }
  487.             }
  488.         }
  489.         return false;
  490.     }
  491.     /**
  492.      * Get main picture
  493.      * @param string $locale
  494.      * @return string
  495.      */
  496.     public function getMainPhoto($locale 'pl') {
  497.         /** @var $photo ProductPhoto */
  498.         foreach ($this->getPhotos() as $photo) {
  499.             if ($photo->getMain()) {
  500.                 /** @var $language Language */
  501.                 foreach ($photo->getLanguages() as $language) {
  502.                     if ($language->getLocaleShort() == $locale) {
  503.                         return $photo->getImageName();
  504.                     }
  505.                 }
  506.             }
  507.         }
  508.         foreach ($this->getPhotos() as $photo) {
  509.             return $photo->getImageName();
  510.         }
  511.         return 'nofoto.jpg';
  512.     }
  513.     public function getOthersProductsPath($locale 'pl') {
  514.         $arr = [];
  515.         /** @var $photo ProductPhoto */
  516.         foreach ($this->getPhotos() as $photo) {
  517.             if (!$photo->getMain()) {
  518.                 /** @var $language Language */
  519.                 foreach ($photo->getLanguages() as $language) {
  520.                     if ($language->getLocaleShort() == $locale) {
  521.                         $arr[] = '/images/product/'.$photo->getImageName();
  522.                     }
  523.                 }
  524.             }
  525.         }
  526.         return $arr;
  527.     }
  528.     /**
  529.      * Gets main photo full path
  530.      * @param string $locale
  531.      * @return string
  532.      */
  533.     public function getMainPhotoPath($locale 'pl') {
  534.         return '/images/product/'.$this->getMainPhoto($locale);
  535.     }
  536.     /**
  537.      * Do not use in product lists - too many queries
  538.      * @param int $parameterId
  539.      * @return ArrayCollection
  540.      */
  541.     public function getAllVariantValues($parameterId 9) {
  542.         $values = new ArrayCollection();
  543.         /** @var $productPrice ProductPrice */
  544.         foreach ($this->getActiveProductPrices() as $productPrice) {
  545.             /** @var $variants ProductPriceVariants */
  546.             foreach ($productPrice->getVariants() as $variants) {
  547.                 if ($variants->getParameterValueGroup()) {
  548.                     foreach ($variants->getParameterValueGroup()->getVisibleValues() as $value) {
  549.                         if ($value->getParameter()->getId() == $parameterId) {
  550.                             $values->add($value);
  551.                         }
  552.                     }
  553.                 } else {
  554.                     if ($variants->getParameter()->getId() == $parameterId) {
  555.                         $values->add($variants->getParameterValue());
  556.                     }
  557.                 }
  558.             }
  559.         }
  560.         return $values;
  561.     }
  562.     public function getProductGroups() {
  563.         $groups = new ArrayCollection();
  564.         /** @var $productPrice ProductPrice */
  565.         foreach ($this->getActiveProductPrices() as $productPrice) {
  566.             /** @var $variants ProductPriceVariants */
  567.             foreach ($productPrice->getVariants() as $variants) {
  568.                 if ($variants->getParameterValueGroup() and !$groups->contains($variants->getParameterValueGroup())) {
  569.                     $groups->add($variants->getParameterValueGroup());
  570.                 }
  571.             }
  572.         }
  573.         return $groups;
  574.     }
  575.     public function getProductGroupsByParameter($parameterId) {
  576.         $groups = new ArrayCollection();
  577.         /** @var $productPrice ProductPrice */
  578.         foreach ($this->getActiveProductPrices() as $productPrice) {
  579.             /** @var $variants ProductPriceVariants */
  580.             foreach ($productPrice->getVariants() as $variants) {
  581.                 if ($variants->getParameterValueGroup() and $variants->getParameter()->getId() == $parameterId and !$groups->contains($variants->getParameterValueGroup())) {
  582.                     $groups->add($variants->getParameterValueGroup());
  583.                 }
  584.             }
  585.         }
  586.         return $groups;
  587.     }
  588.     /**
  589.      * Return array - two elements: price decimal and entity of currency
  590.      *
  591.      * @param null $currency
  592.      * @param ProductVat|null $productVat
  593.      * @return array
  594.      */
  595.     public function getPrice($currency nullProductVat $productVat null) {
  596.         if (is_object($productVat)) {
  597.             $vatRate = ($productVat->getValue()+100)/100;
  598.         } else {
  599.             $vatRate 1;
  600.         }
  601.         /** @var ProductPrice $price */
  602.         foreach ($this->getActiveProductPrices() as $price) {
  603.             if (is_object($currency) and $currency->getId() == $price->getCurrency()->getId()) {
  604.                 $returnPrice round($price->getPrice() * $vatRate,2);
  605.                 return ['price'=>$returnPrice'currency'=>$price->getCurrency()];
  606.             }
  607.         }
  608.         /** @var ProductPrice $price */
  609.         foreach ($this->getActiveProductPrices() as $price) {
  610.             if ($price->getCurrency()->getIsDefault() and $price->getCurrency()->getIsActive()) {
  611.                 $returnPrice round($price->getPrice() * $vatRate,2);
  612.                 return ['price'=>$returnPrice'currency'=>$price->getCurrency()];
  613.             }
  614.         }
  615.     }
  616.     /**
  617.      * Gets hover picture full path
  618.      * @param string $locale
  619.      * @return string
  620.      */
  621.     public function getHoverPhotoPath($locale 'pl') {
  622.         return '/images/product/'.$this->getHoverPhoto($locale);
  623.     }
  624.     /**
  625.      * Get id
  626.      *
  627.      * @return integer
  628.      */
  629.     public function getId()
  630.     {
  631.         return $this->id;
  632.     }
  633.     /**
  634.      * Set symbol
  635.      *
  636.      * @param string $symbol
  637.      *
  638.      * @return Product
  639.      */
  640.     public function setSymbol($symbol)
  641.     {
  642.         $this->symbol $symbol;
  643.         return $this;
  644.     }
  645.     /**
  646.      * Get symbol
  647.      *
  648.      * @return string
  649.      */
  650.     public function getSymbol()
  651.     {
  652.         return $this->symbol;
  653.     }
  654.     /**
  655.      * Add comment
  656.      *
  657.      * @param \App\Entity\ProductComment $comment
  658.      *
  659.      * @return Product
  660.      */
  661.     public function addComment(\App\Entity\ProductComment $comment)
  662.     {
  663.         $this->comments[] = $comment;
  664.         return $this;
  665.     }
  666.     /**
  667.      * Remove comment
  668.      *
  669.      * @param \App\Entity\ProductComment $comment
  670.      */
  671.     public function removeComment(\App\Entity\ProductComment $comment)
  672.     {
  673.         $this->comments->removeElement($comment);
  674.     }
  675.     /**
  676.      * Get comments
  677.      *
  678.      * @return \Doctrine\Common\Collections\Collection
  679.      */
  680.     public function getComments()
  681.     {
  682.         return $this->comments;
  683.     }
  684.     /**
  685.      * Add productPrice
  686.      *
  687.      * @param \App\Entity\ProductPrice $productPrice
  688.      *
  689.      * @return Product
  690.      */
  691.     public function addProductPrice(LangParamRelationInterface $productPrice)
  692.     {
  693.         $productPrice->setProduct($this);
  694.         $this->productPrices[] = $productPrice;
  695.         return $this;
  696.     }
  697.     /**
  698.      * Remove productPrice
  699.      *
  700.      * @param \App\Entity\ProductPrice $productPrice
  701.      */
  702.     public function removeProductPrice(\App\Entity\ProductPrice $productPrice)
  703.     {
  704.         $this->productPrices->removeElement($productPrice);
  705.     }
  706.     /**
  707.      * Get productPrices
  708.      *
  709.      * @return \Doctrine\Common\Collections\Collection
  710.      */
  711.     public function getActiveProductPrices()
  712.     {
  713.         $coll = new ArrayCollection();
  714.         foreach ($this->getProductPrices() as $productPrice) {
  715.             if ($productPrice->getDeletedBy() === null) {
  716.                 $coll->add($productPrice);
  717.             }
  718.         }
  719.         return $coll;
  720.     }
  721.     /**
  722.      * Get productPrices
  723.      *
  724.      * @return \Doctrine\Common\Collections\Collection
  725.      */
  726.     public function getProductPrices()
  727.     {
  728.         return $this->productPrices;
  729.     }
  730.     /**
  731.      * Add photo
  732.      *
  733.      * @param \App\Entity\ProductPhoto $photo
  734.      *
  735.      * @return Product
  736.      */
  737.     public function addPhoto(\App\Entity\ProductPhoto $photo)
  738.     {
  739.         $photo->setProduct($this);
  740.         $this->photos[] = $photo;
  741.         return $this;
  742.     }
  743.     /**
  744.      * Remove photo
  745.      *
  746.      * @param \App\Entity\ProductPhoto $photo
  747.      */
  748.     public function removePhoto(\App\Entity\ProductPhoto $photo)
  749.     {
  750.         $this->photos->removeElement($photo);
  751.     }
  752.     /**
  753.      * Get photos
  754.      *
  755.      * @return \Doctrine\Common\Collections\Collection
  756.      */
  757.     public function getPhotos()
  758.     {
  759.         return $this->photos;
  760.     }
  761.     /**
  762.      * Add category
  763.      *
  764.      * @param \App\Entity\ProductCategory $category
  765.      *
  766.      * @return Product
  767.      */
  768.     public function addCategory(\App\Entity\ProductCategory $category)
  769.     {
  770.         $this->categories[] = $category;
  771.         return $this;
  772.     }
  773.     /**
  774.      * Remove category
  775.      *
  776.      * @param \App\Entity\ProductCategory $category
  777.      */
  778.     public function removeCategory(\App\Entity\ProductCategory $category)
  779.     {
  780.         $this->categories->removeElement($category);
  781.     }
  782.     /**
  783.      * Get categories
  784.      *
  785.      * @return \Doctrine\Common\Collections\Collection
  786.      */
  787.     public function getCategories()
  788.     {
  789.         return $this->categories;
  790.     }
  791.     /**
  792.      * Add recommendation
  793.      *
  794.      * @param \App\Entity\ProductRecommendation $recommendation
  795.      *
  796.      * @return Product
  797.      */
  798.     public function addRecommendation(\App\Entity\ProductRecommendation $recommendation)
  799.     {
  800.         $recommendation->setProduct($this);
  801.         $this->recommendations[] = $recommendation;
  802.         return $this;
  803.     }
  804.     /**
  805.      * Remove recommendation
  806.      *
  807.      * @param \App\Entity\ProductRecommendation $recommendation
  808.      */
  809.     public function removeRecommendation(\App\Entity\ProductRecommendation $recommendation)
  810.     {
  811.         $this->recommendations->removeElement($recommendation);
  812.     }
  813.     /**
  814.      * Get recommendations
  815.      *
  816.      * @return \Doctrine\Common\Collections\Collection
  817.      */
  818.     public function getRecommendations()
  819.     {
  820.         return $this->recommendations;
  821.     }
  822.     public function getRecommendationsIds($locale 'pl') {
  823.         $ids = [];
  824.         /** @var $recommendation ProductRecommendation */
  825.         foreach ($this->getRecommendations() as $recommendation) {
  826.             $visible false;
  827.             foreach ($recommendation->getLanguages() as $language) {
  828.                 if ($language->getLocale() == $locale) {
  829.                     $visible true;
  830.                     break;
  831.                 }
  832.             }
  833.             if ($visible) {
  834.                 $ids[] = $recommendation->getRecommendation()->getId();
  835.             }
  836.         }
  837.         return $ids;
  838.     }
  839.     public function getSimilarColorsIds() {
  840.         $ids = [];
  841.         /** @var $recommendation ProductSimilarColors */
  842.         foreach ($this->getSimilarColors() as $recommendation) {
  843.             $ids[] = $recommendation->getSimilar()->getId();
  844.         }
  845.         return $ids;
  846.     }
  847.     public function getProductFamily(): ?ProductFamily
  848.     {
  849.         return $this->productFamily;
  850.     }
  851.     public function setProductFamily(?ProductFamily $productFamily): self
  852.     {
  853.         $this->productFamily $productFamily;
  854.         return $this;
  855.     }
  856.     /**
  857.      * @return Collection|ProductFurnitureType[]
  858.      */
  859.     public function getFurnitureTypes(): Collection
  860.     {
  861.         return $this->furnitureTypes;
  862.     }
  863.     public function addFurnitureType(ProductFurnitureType $furnitureType): self
  864.     {
  865.         if (!$this->furnitureTypes->contains($furnitureType)) {
  866.             $this->furnitureTypes[] = $furnitureType;
  867.             $furnitureType->setProduct($this);
  868.         }
  869.         return $this;
  870.     }
  871.     public function removeFurnitureType(ProductFurnitureType $furnitureType): self
  872.     {
  873.         if ($this->furnitureTypes->contains($furnitureType)) {
  874.             $this->furnitureTypes->removeElement($furnitureType);
  875.             // set the owning side to null (unless already changed)
  876.             if ($furnitureType->getProduct() === $this) {
  877.                 $furnitureType->setProduct(null);
  878.             }
  879.         }
  880.         return $this;
  881.     }
  882.     /**
  883.      * @param $locale
  884.      * @return ProductLangParam
  885.      */
  886.     public function getLangParamByLocale($locale) {
  887.         foreach ($this->getLangParams() as $langParam) {
  888.             if ($langParam->getLanguage()->getLocale() == $locale) {
  889.                 return $langParam;
  890.             }
  891.         }
  892.     }
  893.     /**
  894.      * @return Collection|ProductLangParam[]
  895.      */
  896.     public function getLangParams(): Collection
  897.     {
  898.         return $this->langParams;
  899.     }
  900.     public function addLangParam(LangParamRelationInterface $langParam): self
  901.     {
  902.         if (!$this->langParams->contains($langParam)) {
  903.             $this->langParams[] = $langParam;
  904.             $langParam->setProduct($this);
  905.         }
  906.         return $this;
  907.     }
  908.     public function removeLangParam(ProductLangParam $langParam): self
  909.     {
  910.         if ($this->langParams->contains($langParam)) {
  911.             $this->langParams->removeElement($langParam);
  912.             // set the owning side to null (unless already changed)
  913.             if ($langParam->getProduct() === $this) {
  914.                 $langParam->setProduct(null);
  915.             }
  916.         }
  917.         return $this;
  918.     }
  919.     public function getIsVariants(): ?bool
  920.     {
  921.         return $this->isVariants;
  922.     }
  923.     public function setIsVariants(?bool $isVariants): self
  924.     {
  925.         $this->isVariants $isVariants;
  926.         return $this;
  927.     }
  928.     public function getIsCompare(): ?bool
  929.     {
  930.         return $this->isCompare;
  931.     }
  932.     public function setIsCompare(?bool $isCompare): self
  933.     {
  934.         $this->isCompare $isCompare;
  935.         return $this;
  936.     }
  937.     public function getPrioritySearchEngine(): ?int
  938.     {
  939.         return $this->prioritySearchEngine;
  940.     }
  941.     public function setPrioritySearchEngine(?int $prioritySearchEngine): self
  942.     {
  943.         $this->prioritySearchEngine $prioritySearchEngine;
  944.         return $this;
  945.     }
  946.     public function getIsNegotiate(): ?bool
  947.     {
  948.         return $this->isNegotiate;
  949.     }
  950.     public function setIsNegotiate(?bool $isNegotiate): self
  951.     {
  952.         $this->isNegotiate $isNegotiate;
  953.         return $this;
  954.     }
  955.     public function getIsRebateCode(): ?bool
  956.     {
  957.         return $this->isRebateCode;
  958.     }
  959.     public function setIsRebateCode(?bool $isRebateCode): self
  960.     {
  961.         $this->isRebateCode $isRebateCode;
  962.         return $this;
  963.     }
  964.     public function setMainCategory(?Category $mainCategory): self
  965.     {
  966.         $this->mainCategory $mainCategory;
  967.         return $this;
  968.     }
  969.     public function getMainCategory(): ?Category
  970.     {
  971.         return $this->mainCategory;
  972.     }
  973.     /**
  974.      * @return Collection|CompareParameterValue[]
  975.      */
  976.     public function getCompareValues(): Collection
  977.     {
  978.         return $this->compareValues;
  979.     }
  980.     public function addCompareValue(CompareParameterValue $compareValue): self
  981.     {
  982.         if (!$this->compareValues->contains($compareValue)) {
  983.             $this->compareValues[] = $compareValue;
  984.             $compareValue->setProduct($this);
  985.         }
  986.         return $this;
  987.     }
  988.     public function removeCompareValue(CompareParameterValue $compareValue): self
  989.     {
  990.         if ($this->compareValues->contains($compareValue)) {
  991.             $this->compareValues->removeElement($compareValue);
  992.             // set the owning side to null (unless already changed)
  993.             if ($compareValue->getProduct() === $this) {
  994.                 $compareValue->setProduct(null);
  995.             }
  996.         }
  997.         return $this;
  998.     }
  999.     /**
  1000.      * @return Collection|ProductFilter[]
  1001.      */
  1002.     public function getFilters(): Collection
  1003.     {
  1004.         return $this->filters;
  1005.     }
  1006.     public function addFilter(ProductFilter $filter): self
  1007.     {
  1008.         if (!$this->filters->contains($filter)) {
  1009.             $this->filters[] = $filter;
  1010.             $filter->setProduct($this);
  1011.         }
  1012.         return $this;
  1013.     }
  1014.     public function removeFilter(ProductFilter $filter): self
  1015.     {
  1016.         if ($this->filters->contains($filter)) {
  1017.             $this->filters->removeElement($filter);
  1018.             // set the owning side to null (unless already changed)
  1019.             if ($filter->getProduct() === $this) {
  1020.                 $filter->setProduct(null);
  1021.             }
  1022.         }
  1023.         return $this;
  1024.     }
  1025.     public function getAvailability($locale 'pl')
  1026.     {
  1027.         foreach ($this->getLangParams() as $langParam) {
  1028.             if ($langParam->getLanguage()->getLocaleShort() == $locale) {
  1029.                 return $langParam->getAvailability();
  1030.             }
  1031.         }
  1032.         return null;
  1033.     }
  1034.     public function getProducer($locale 'pl')
  1035.     {
  1036.         foreach ($this->getLangParams() as $langParam) {
  1037.             if ($langParam->getLanguage()->getLocaleShort() == $locale) {
  1038.                 return $langParam->getProductProducer();
  1039.             }
  1040.         }
  1041.         return null;
  1042.     }
  1043.     public function setAvailability(?Availability $availability): self
  1044.     {
  1045.         $this->availability $availability;
  1046.         return $this;
  1047.     }
  1048.     public function getOldPrice()
  1049.     {
  1050.         return $this->oldPrice;
  1051.     }
  1052.     public function setOldPrice($oldPrice): self
  1053.     {
  1054.         $this->oldPrice $oldPrice;
  1055.         return $this;
  1056.     }
  1057.     public function getFilm()
  1058.     {
  1059.         return $this->translate()->getTransFilm();
  1060.     }
  1061.     public function getProductProducer($locale 'pl')
  1062.     {
  1063.         foreach ($this->getLangParams() as $langParam) {
  1064.             if ($langParam->getLanguage()->getLocaleShort() == $locale) {
  1065.                 return $langParam->getProductProducer();
  1066.             }
  1067.         }
  1068.         return $this->productProducer;
  1069.     }
  1070.     public function setProductProducer(?ProductProducer $productProducer): self
  1071.     {
  1072.         $this->productProducer $productProducer;
  1073.         return $this;
  1074.     }
  1075.     public function getPhoto3d(): ?string
  1076.     {
  1077.         return $this->photo3d;
  1078.     }
  1079.     public function setPhoto3d(?string $photo3d): self
  1080.     {
  1081.         $this->photo3d $photo3d;
  1082.         return $this;
  1083.     }
  1084.     /**
  1085.      * @return Collection|Marker[]
  1086.      */
  1087.     public function getMarkers(): Collection
  1088.     {
  1089.         return $this->markers;
  1090.     }
  1091.     public function addMarker(Marker $marker): self
  1092.     {
  1093.         if (!$this->markers->contains($marker)) {
  1094.             $this->markers[] = $marker;
  1095.         }
  1096.         return $this;
  1097.     }
  1098.     public function removeMarker(Marker $marker): self
  1099.     {
  1100.         if ($this->markers->contains($marker)) {
  1101.             $this->markers->removeElement($marker);
  1102.         }
  1103.         return $this;
  1104.     }
  1105.     /**
  1106.      * @return Collection|DeliveryMethod[]
  1107.      */
  1108.     public function getSpecialDeliveryMethods(): Collection
  1109.     {
  1110.         return $this->specialDeliveryMethods;
  1111.     }
  1112.     public function addSpecialDeliveryMethod(DeliveryMethod $specialDeliveryMethod): self
  1113.     {
  1114.         if (!$this->specialDeliveryMethods->contains($specialDeliveryMethod)) {
  1115.             $this->specialDeliveryMethods[] = $specialDeliveryMethod;
  1116.         }
  1117.         return $this;
  1118.     }
  1119.     public function removeSpecialDeliveryMethod(DeliveryMethod $specialDeliveryMethod): self
  1120.     {
  1121.         if ($this->specialDeliveryMethods->contains($specialDeliveryMethod)) {
  1122.             $this->specialDeliveryMethods->removeElement($specialDeliveryMethod);
  1123.         }
  1124.         return $this;
  1125.     }
  1126.     /**
  1127.      * @return Collection|ProductXml[]
  1128.      */
  1129.     public function getProductXml(): Collection
  1130.     {
  1131.         return $this->productXml;
  1132.     }
  1133.     public function addProductXml(ProductXml $productXml): self
  1134.     {
  1135.         if (!$this->productXml->contains($productXml)) {
  1136.             $this->productXml[] = $productXml;
  1137.             $productXml->setProduct($this);
  1138.         }
  1139.         return $this;
  1140.     }
  1141.     public function removeProductXml(ProductXml $productXml): self
  1142.     {
  1143.         if ($this->productXml->contains($productXml)) {
  1144.             $this->productXml->removeElement($productXml);
  1145.             // set the owning side to null (unless already changed)
  1146.             if ($productXml->getProduct() === $this) {
  1147.                 $productXml->setProduct(null);
  1148.             }
  1149.         }
  1150.         return $this;
  1151.     }
  1152.     public function getActiveEquipment() {
  1153.         $c = new ArrayCollection();
  1154.         foreach ($this->getEquipments() as $equipment) {
  1155.             if ($equipment->getDeletedBy() === null && $equipment->isVisible()) {
  1156.                 $c->add($equipment);
  1157.             }
  1158.         }
  1159.         return $c;
  1160.     }
  1161.     /**
  1162.      * @return Collection|ProductEquipment[]
  1163.      */
  1164.     public function getEquipments(): Collection
  1165.     {
  1166.         return $this->equipments;
  1167.     }
  1168.     public function addEquipment(ProductEquipment $equipment): self
  1169.     {
  1170.         if (!$this->equipments->contains($equipment)) {
  1171.             $this->equipments[] = $equipment;
  1172.         }
  1173.         return $this;
  1174.     }
  1175.     public function removeEquipment(ProductEquipment $equipment): self
  1176.     {
  1177.         if ($this->equipments->contains($equipment)) {
  1178.             $this->equipments->removeElement($equipment);
  1179.         }
  1180.         return $this;
  1181.     }
  1182.     public function getAvailableTranslations() {
  1183.         $current $this->getTranslations();
  1184.         $trans = [];
  1185.         /** @var $tran ProductTranslation */
  1186.         foreach ($current as $tran) {
  1187.             $trans[] = $tran->getLocale();
  1188.         }
  1189.         $all = ['sk''cz''pl''ro'];
  1190.         $data = [];
  1191.         foreach ($all as $lang) {
  1192.             if (in_array($lang$trans)) {
  1193.                 $data[] = ['lang'=>$lang'available'=>1];
  1194.             } else {
  1195.                 $data[] = ['lang'=>$lang'available'=>0];
  1196.             }
  1197.         }
  1198.         return $data;
  1199.     }
  1200.     public function getAvailablePrices() {
  1201.         $current $this->getActiveProductPrices();
  1202.         $trans = [];
  1203.         /** @var $tran ProductPrice */
  1204.         foreach ($current as $tran) {
  1205.             $trans[] = $tran->getLanguage()->getLocale();
  1206.         }
  1207.         $all = ['sk''cz''pl''ro'];
  1208.         $data = [];
  1209.         foreach ($all as $lang) {
  1210.             if (in_array($lang$trans)) {
  1211.                 $data[] = ['lang'=>$lang'available'=>1];
  1212.             } else {
  1213.                 $data[] = ['lang'=>$lang'available'=>0];
  1214.             }
  1215.         }
  1216.         return $data;
  1217.     }
  1218.     public function setFilm(?string $film): self
  1219.     {
  1220.         $this->film $film;
  1221.         return $this;
  1222.     }
  1223.     /**
  1224.      * @return Collection|LandingPage[]
  1225.      */
  1226.     public function getLandingPages(): Collection
  1227.     {
  1228.         return $this->landingPages;
  1229.     }
  1230.     public function addLandingPage(LandingPage $landingPage): self
  1231.     {
  1232.         if (!$this->landingPages->contains($landingPage)) {
  1233.             $this->landingPages[] = $landingPage;
  1234.             $landingPage->addProduct($this);
  1235.         }
  1236.         return $this;
  1237.     }
  1238.     public function removeLandingPage(LandingPage $landingPage): self
  1239.     {
  1240.         if ($this->landingPages->contains($landingPage)) {
  1241.             $this->landingPages->removeElement($landingPage);
  1242.             $landingPage->removeProduct($this);
  1243.         }
  1244.         return $this;
  1245.     }
  1246.     public function isSetPrice(Language $language) {
  1247.         /** @var $activeProductPrice ProductPrice */
  1248.         foreach ($this->getActiveProductPrices() as $activeProductPrice) {
  1249.             if ($activeProductPrice->getLanguage()->getId() == $language->getId()) {
  1250.                 return true;
  1251.             }
  1252.         }
  1253.         return false;
  1254.     }
  1255.     /**
  1256.      * @return Collection|Marker[]
  1257.      */
  1258.     public function getListingMarkers(): Collection
  1259.     {
  1260.         return $this->listingMarkers;
  1261.     }
  1262.     public function addListingMarker(Marker $listingMarker): self
  1263.     {
  1264.         if (!$this->listingMarkers->contains($listingMarker)) {
  1265.             $this->listingMarkers[] = $listingMarker;
  1266.         }
  1267.         return $this;
  1268.     }
  1269.     public function removeListingMarker(Marker $listingMarker): self
  1270.     {
  1271.         if ($this->listingMarkers->contains($listingMarker)) {
  1272.             $this->listingMarkers->removeElement($listingMarker);
  1273.         }
  1274.         return $this;
  1275.     }
  1276.     /**
  1277.      * @return string
  1278.      */
  1279.     public function getListingMarkersIds()
  1280.     {
  1281.         return $this->listingMarkersIds;
  1282.     }
  1283.     /**
  1284.      * @param string $listingMarkersIds
  1285.      */
  1286.     public function setListingMarkersIds($listingMarkersIds)
  1287.     {
  1288.         $this->listingMarkersIds $listingMarkersIds;
  1289.     }
  1290.     /**
  1291.      * @return mixed
  1292.      */
  1293.     public function getHalmarStockExchange()
  1294.     {
  1295.         return $this->halmarStockExchange;
  1296.     }
  1297.     /**
  1298.      * @param mixed $halmarStockExchange
  1299.      */
  1300.     public function setHalmarStockExchange($halmarStockExchange)
  1301.     {
  1302.         $this->halmarStockExchange $halmarStockExchange;
  1303.     }
  1304.     /**
  1305.      * @return Collection|SubProduct[]
  1306.      */
  1307.     public function getSubProducts(): Collection
  1308.     {
  1309.         return $this->subProducts;
  1310.     }
  1311.     public function addSubProduct(SubProduct $subProduct): self
  1312.     {
  1313.         if (!$this->subProducts->contains($subProduct)) {
  1314.             $this->subProducts[] = $subProduct;
  1315.             $subProduct->setProduct($this);
  1316.         }
  1317.         return $this;
  1318.     }
  1319.     public function removeSubProduct(SubProduct $subProduct): self
  1320.     {
  1321.         if ($this->subProducts->removeElement($subProduct)) {
  1322.             // set the owning side to null (unless already changed)
  1323.             if ($subProduct->getProduct() === $this) {
  1324.                 $subProduct->setProduct(null);
  1325.             }
  1326.         }
  1327.         return $this;
  1328.     }
  1329.     /**
  1330.      * @return bool
  1331.      */
  1332.     public function isAutomaticPrice(): bool
  1333.     {
  1334.         return $this->automaticPrice;
  1335.     }
  1336.     /**
  1337.      * @param bool $automaticPrice
  1338.      */
  1339.     public function setAutomaticPrice(bool $automaticPrice): void
  1340.     {
  1341.         $this->automaticPrice $automaticPrice;
  1342.     }
  1343.     public function getAutomaticPrice(): ?bool
  1344.     {
  1345.         return $this->automaticPrice;
  1346.     }
  1347.     /**
  1348.      * @return Collection|ProductPriceDraft[]
  1349.      */
  1350.     public function getProductPriceDrafts(): Collection
  1351.     {
  1352.         return $this->productPriceDrafts;
  1353.     }
  1354.     public function addProductPriceDraft(ProductPriceDraft $productPriceDraft): self
  1355.     {
  1356.         if (!$this->productPriceDrafts->contains($productPriceDraft)) {
  1357.             $this->productPriceDrafts[] = $productPriceDraft;
  1358.             $productPriceDraft->setProduct($this);
  1359.         }
  1360.         return $this;
  1361.     }
  1362.     public function removeProductPriceDraft(ProductPriceDraft $productPriceDraft): self
  1363.     {
  1364.         if ($this->productPriceDrafts->removeElement($productPriceDraft)) {
  1365.             // set the owning side to null (unless already changed)
  1366.             if ($productPriceDraft->getProduct() === $this) {
  1367.                 $productPriceDraft->setProduct(null);
  1368.             }
  1369.         }
  1370.         return $this;
  1371.     }
  1372.     /**
  1373.      * @return Collection|ProductPriceChangeLog[]
  1374.      */
  1375.     public function getProductPriceChangeLog(): Collection
  1376.     {
  1377.         return $this->productPriceChangeLog;
  1378.     }
  1379.     public function addProductPriceChangeLog(ProductPriceChangeLog $productPriceChangeLog): self
  1380.     {
  1381.         if (!$this->productPriceChangeLog->contains($productPriceChangeLog)) {
  1382.             $this->productPriceChangeLog[] = $productPriceChangeLog;
  1383.             $productPriceChangeLog->setProduct($this);
  1384.         }
  1385.         return $this;
  1386.     }
  1387.     public function removeProductPriceChangeLog(ProductPriceChangeLog $productPriceChangeLog): self
  1388.     {
  1389.         if ($this->productPriceChangeLog->removeElement($productPriceChangeLog)) {
  1390.             // set the owning side to null (unless already changed)
  1391.             if ($productPriceChangeLog->getProduct() === $this) {
  1392.                 $productPriceChangeLog->setProduct(null);
  1393.             }
  1394.         }
  1395.         return $this;
  1396.     }
  1397.     /**
  1398.      * @return mixed
  1399.      */
  1400.     public function getPayu()
  1401.     {
  1402.         return $this->payu;
  1403.     }
  1404.     /**
  1405.      * @param mixed $payu
  1406.      */
  1407.     public function setPayu($payu): void
  1408.     {
  1409.         $this->payu $payu;
  1410.     }
  1411.     /**
  1412.      * @return mixed
  1413.      */
  1414.     public function getTemporaryUnavailable()
  1415.     {
  1416.         return $this->temporaryUnavailable;
  1417.     }
  1418.     /**
  1419.      * @param mixed $temporaryUnavailable
  1420.      */
  1421.     public function setTemporaryUnavailable($temporaryUnavailable)
  1422.     {
  1423.         $this->temporaryUnavailable $temporaryUnavailable;
  1424.     }
  1425.     /**
  1426.      * @return Collection|ProductCrossSelling[]
  1427.      */
  1428.     public function getCrossSelling(): Collection
  1429.     {
  1430.         return $this->crossSelling;
  1431.     }
  1432.     public function addCrossSelling(ProductCrossSelling $crossSelling): self
  1433.     {
  1434.         if (!$this->crossSelling->contains($crossSelling)) {
  1435.             $this->crossSelling[] = $crossSelling;
  1436.             $crossSelling->setProduct($this);
  1437.         }
  1438.         return $this;
  1439.     }
  1440.     public function removeCrossSelling(ProductCrossSelling $crossSelling): self
  1441.     {
  1442.         if ($this->crossSelling->removeElement($crossSelling)) {
  1443.             // set the owning side to null (unless already changed)
  1444.             if ($crossSelling->getProduct() === $this) {
  1445.                 $crossSelling->setProduct(null);
  1446.             }
  1447.         }
  1448.         return $this;
  1449.     }
  1450.     /**
  1451.      * @return \DateTime
  1452.      */
  1453.     public function getLastRankingUpdate(): \DateTime
  1454.     {
  1455.         return $this->lastRankingUpdate;
  1456.     }
  1457.     /**
  1458.      * @param \DateTime $lastRankingUpdate
  1459.      */
  1460.     public function setLastRankingUpdate(\DateTime $lastRankingUpdate): void
  1461.     {
  1462.         $this->lastRankingUpdate $lastRankingUpdate;
  1463.     }
  1464.     /**
  1465.      * Add color
  1466.      *
  1467.      * @param \App\Entity\ProductColor $color
  1468.      *
  1469.      * @return Product
  1470.      */
  1471.     public function addColor(\App\Entity\ProductColor $color)
  1472.     {
  1473.         $this->colors[] = $color;
  1474.         return $this;
  1475.     }
  1476.     /**
  1477.      * Remove color
  1478.      *
  1479.      * @param \App\Entity\ProductColor $color
  1480.      */
  1481.     public function removeColor(\App\Entity\ProductColor $color)
  1482.     {
  1483.         $this->colors->removeElement($color);
  1484.     }
  1485.     /**
  1486.      * Get colors
  1487.      *
  1488.      * @return \Doctrine\Common\Collections\Collection
  1489.      */
  1490.     public function getColors()
  1491.     {
  1492.         return $this->colors;
  1493.     }
  1494.     public function getColorsIds() {
  1495.         $ids = [];
  1496.         /** @var $color ProductColor */
  1497.         foreach ($this->getColors() as $color) {
  1498.             if ($color->getDeletedBy() == null) {
  1499.                 $ids[] = $color->getId();
  1500.             }
  1501.         }
  1502.         return $ids;
  1503.     }
  1504.     /**
  1505.      * @return bool
  1506.      */
  1507.     public function isDiabloStockExchange()
  1508.     {
  1509.         return $this->diabloStockExchange;
  1510.     }
  1511.     public function getDiabloStockExchange() {
  1512.         return $this->diabloStockExchange;
  1513.     }
  1514.     /**
  1515.      * @param bool $diabloStockExchange
  1516.      */
  1517.     public function setDiabloStockExchange(bool $diabloStockExchange)
  1518.     {
  1519.         $this->diabloStockExchange $diabloStockExchange;
  1520.     }
  1521.     /**
  1522.      * @return mixed
  1523.      */
  1524.     public function getIsPaletteDelivery()
  1525.     {
  1526.         return $this->isPaletteDelivery;
  1527.     }
  1528.     /**
  1529.      * @param mixed $isPaletteDelivery
  1530.      */
  1531.     public function setIsPaletteDelivery($isPaletteDelivery)
  1532.     {
  1533.         $this->isPaletteDelivery $isPaletteDelivery;
  1534.     }
  1535.     /**
  1536.      * @return bool
  1537.      */
  1538.     public function isActonaStockExchange(): bool
  1539.     {
  1540.         return $this->actonaStockExchange;
  1541.     }
  1542.     /**
  1543.      * @param bool $actonaStockExchange
  1544.      */
  1545.     public function setActonaStockExchange(bool $actonaStockExchange): void
  1546.     {
  1547.         $this->actonaStockExchange $actonaStockExchange;
  1548.     }
  1549.     public function getActonaStockExchange(): ?bool
  1550.     {
  1551.         return $this->actonaStockExchange;
  1552.     }
  1553.     /**
  1554.      * @return bool
  1555.      */
  1556.     public function isJanNowakStockExchange(): bool
  1557.     {
  1558.         return $this->janNowakStockExchange;
  1559.     }
  1560.     /**
  1561.      * @return bool
  1562.      */
  1563.     public function getJanNowakStockExchange(): bool
  1564.     {
  1565.         return $this->janNowakStockExchange;
  1566.     }
  1567.     /**
  1568.      * @param bool $janNowakStockExchange
  1569.      */
  1570.     public function setJanNowakStockExchange(bool $janNowakStockExchange): void
  1571.     {
  1572.         $this->janNowakStockExchange $janNowakStockExchange;
  1573.     }
  1574.     /**
  1575.      * @return int
  1576.      */
  1577.     public function getHeight()
  1578.     {
  1579.         return $this->height;
  1580.     }
  1581.     /**
  1582.      * @param int $height
  1583.      */
  1584.     public function setHeight($height)
  1585.     {
  1586.         $this->height $height;
  1587.     }
  1588.     /**
  1589.      * @return int
  1590.      */
  1591.     public function getWidth()
  1592.     {
  1593.         return $this->width;
  1594.     }
  1595.     /**
  1596.      * @param int $width
  1597.      */
  1598.     public function setWidth($width)
  1599.     {
  1600.         $this->width $width;
  1601.     }
  1602.     /**
  1603.      * @return int
  1604.      */
  1605.     public function getDepth()
  1606.     {
  1607.         return $this->depth;
  1608.     }
  1609.     /**
  1610.      * @param int $depth
  1611.      */
  1612.     public function setDepth($depth)
  1613.     {
  1614.         $this->depth $depth;
  1615.     }
  1616.     /**
  1617.      * @return Collection|ProductSimilarColors[]
  1618.      */
  1619.     public function getSimilarColors(): Collection
  1620.     {
  1621.         return $this->similarColors;
  1622.     }
  1623.     public function addSimilarColor(ProductSimilarColors $similarColor): self
  1624.     {
  1625.         if (!$this->similarColors->contains($similarColor)) {
  1626.             $this->similarColors[] = $similarColor;
  1627.             $similarColor->setProduct($this);
  1628.         }
  1629.         return $this;
  1630.     }
  1631.     public function removeSimilarColor(ProductSimilarColors $similarColor): self
  1632.     {
  1633.         if ($this->similarColors->removeElement($similarColor)) {
  1634.             // set the owning side to null (unless already changed)
  1635.             if ($similarColor->getProduct() === $this) {
  1636.                 $similarColor->setProduct(null);
  1637.             }
  1638.         }
  1639.         return $this;
  1640.     }
  1641.     public function getShippingCategory(): ?string
  1642.     {
  1643.         return $this->shippingCategory;
  1644.     }
  1645.     public function setShippingCategory($shippingCategory): void
  1646.     {
  1647.         $this->shippingCategory $shippingCategory;
  1648.     }
  1649.     public function isUniqueStockExchange(): bool
  1650.     {
  1651.         return $this->uniqueStockExchange;
  1652.     }
  1653.     public function getUniqueStockExchange(): bool
  1654.     {
  1655.         return $this->uniqueStockExchange;
  1656.     }
  1657.     public function setUniqueStockExchange($uniqueStockExchange): void
  1658.     {
  1659.         $this->uniqueStockExchange $uniqueStockExchange;
  1660.     }
  1661.     public function isSignalStockExchange()
  1662.     {
  1663.         return $this->signalStockExchange;
  1664.     }
  1665.     public function getSignalStockExchange()
  1666.     {
  1667.         return $this->signalStockExchange;
  1668.     }
  1669.     public function setSignalStockExchange($signalStockExchange)
  1670.     {
  1671.         $this->signalStockExchange $signalStockExchange;
  1672.     }
  1673. }