app/proxy/entity/src/Eccube/Entity/Product.php line 29

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Eccube\Entity;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Doctrine\ORM\Mapping as ORM;
  15.     /**
  16.      * Product
  17.      *
  18.      * @ORM\Table(name="dtb_product")
  19.      * @ORM\InheritanceType("SINGLE_TABLE")
  20.      * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  21.      * @ORM\HasLifecycleCallbacks()
  22.      * @ORM\Entity(repositoryClass="Eccube\Repository\ProductRepository")
  23.      */
  24.     class Product extends \Eccube\Entity\AbstractEntity
  25.     {
  26.     use \Plugin\PurchaseQuantityLimit4\Entity\ProductTrait\Plugin\ProductDisplayRank4\Entity\ProductTrait\Plugin\RelatedProduct42\Entity\ProductTrait\Plugin\CustomerRank42\Entity\ProductTrait\Plugin\ExpressLink42\Entity\ProductTrait;
  27.         private $_calc false;
  28.         private $stockFinds = [];
  29.         private $stocks = [];
  30.         private $stockUnlimiteds = [];
  31.         private $price01 = [];
  32.         private $price02 = [];
  33.         private $price01IncTaxs = [];
  34.         private $price02IncTaxs = [];
  35.         private $codes = [];
  36.         private $classCategories1 = [];
  37.         private $classCategories2 = [];
  38.         private $className1;
  39.         private $className2;
  40.         /**
  41.          * @return string
  42.          */
  43.         public function __toString()
  44.         {
  45.             return (string) $this->getName();
  46.         }
  47.         public function _calc()
  48.         {
  49.             if (!$this->_calc) {
  50.                 $i 0;
  51.                 foreach ($this->getProductClasses() as $ProductClass) {
  52.                     /* @var $ProductClass \Eccube\Entity\ProductClass */
  53.                     // stock_find
  54.                     if ($ProductClass->isVisible() == false) {
  55.                         continue;
  56.                     }
  57.                     $ClassCategory1 $ProductClass->getClassCategory1();
  58.                     $ClassCategory2 $ProductClass->getClassCategory2();
  59.                     if ($ClassCategory1 && !$ClassCategory1->isVisible()) {
  60.                         continue;
  61.                     }
  62.                     if ($ClassCategory2 && !$ClassCategory2->isVisible()) {
  63.                         continue;
  64.                     }
  65.                     // stock_find
  66.                     $this->stockFinds[] = $ProductClass->getStockFind();
  67.                     // stock
  68.                     $this->stocks[] = $ProductClass->getStock();
  69.                     // stock_unlimited
  70.                     $this->stockUnlimiteds[] = $ProductClass->isStockUnlimited();
  71.                     // price01
  72.                     if (!is_null($ProductClass->getPrice01())) {
  73.                         $this->price01[] = $ProductClass->getPrice01();
  74.                         // price01IncTax
  75.                         $this->price01IncTaxs[] = $ProductClass->getPrice01IncTax();
  76.                     }
  77.                     // price02
  78.                     $this->price02[] = $ProductClass->getPrice02();
  79.                     // price02IncTax
  80.                     $this->price02IncTaxs[] = $ProductClass->getPrice02IncTax();
  81.                     // product_code
  82.                     $this->codes[] = $ProductClass->getCode();
  83.                     if ($i === 0) {
  84.                         if ($ProductClass->getClassCategory1() && $ProductClass->getClassCategory1()->getId()) {
  85.                             $this->className1 $ProductClass->getClassCategory1()->getClassName()->getName();
  86.                         }
  87.                         if ($ProductClass->getClassCategory2() && $ProductClass->getClassCategory2()->getId()) {
  88.                             $this->className2 $ProductClass->getClassCategory2()->getClassName()->getName();
  89.                         }
  90.                     }
  91.                     if ($ProductClass->getClassCategory1()) {
  92.                         $classCategoryId1 $ProductClass->getClassCategory1()->getId();
  93.                         if (!empty($classCategoryId1)) {
  94.                             if ($ProductClass->getClassCategory2()) {
  95.                                 $this->classCategories1[$ProductClass->getClassCategory1()->getId()] = $ProductClass->getClassCategory1()->getName();
  96.                                 $this->classCategories2[$ProductClass->getClassCategory1()->getId()][$ProductClass->getClassCategory2()->getId()] = $ProductClass->getClassCategory2()->getName();
  97.                             } else {
  98.                                 $this->classCategories1[$ProductClass->getClassCategory1()->getId()] = $ProductClass->getClassCategory1()->getName().($ProductClass->getStockFind() ? '' trans('front.product.out_of_stock_label'));
  99.                             }
  100.                         }
  101.                     }
  102.                     $i++;
  103.                 }
  104.                 $this->_calc true;
  105.             }
  106.         }
  107.         /**
  108.          * Is Enable
  109.          *
  110.          * @return bool
  111.          *
  112.          * @deprecated
  113.          */
  114.         public function isEnable()
  115.         {
  116.             return $this->getStatus()->getId() === \Eccube\Entity\Master\ProductStatus::DISPLAY_SHOW true false;
  117.         }
  118.         /**
  119.          * Get ClassName1
  120.          *
  121.          * @return string
  122.          */
  123.         public function getClassName1()
  124.         {
  125.             $this->_calc();
  126.             return $this->className1;
  127.         }
  128.         /**
  129.          * Get ClassName2
  130.          *
  131.          * @return string
  132.          */
  133.         public function getClassName2()
  134.         {
  135.             $this->_calc();
  136.             return $this->className2;
  137.         }
  138.         /**
  139.          * Get getClassCategories1
  140.          *
  141.          * @return array
  142.          */
  143.         public function getClassCategories1()
  144.         {
  145.             $this->_calc();
  146.             return $this->classCategories1;
  147.         }
  148.         public function getClassCategories1AsFlip()
  149.         {
  150.             return array_flip($this->getClassCategories1());
  151.         }
  152.         /**
  153.          * Get getClassCategories2
  154.          *
  155.          * @return array
  156.          */
  157.         public function getClassCategories2($class_category1)
  158.         {
  159.             $this->_calc();
  160.             return isset($this->classCategories2[$class_category1]) ? $this->classCategories2[$class_category1] : [];
  161.         }
  162.         public function getClassCategories2AsFlip($class_category1)
  163.         {
  164.             return array_flip($this->getClassCategories2($class_category1));
  165.         }
  166.         /**
  167.          * Get StockFind
  168.          *
  169.          * @return bool
  170.          */
  171.         public function getStockFind()
  172.         {
  173.             $this->_calc();
  174.             return count($this->stockFinds)
  175.                 ? max($this->stockFinds)
  176.                 : null;
  177.         }
  178.         /**
  179.          * Get Stock min
  180.          *
  181.          * @return integer
  182.          */
  183.         public function getStockMin()
  184.         {
  185.             $this->_calc();
  186.             return count($this->stocks)
  187.                 ? min($this->stocks)
  188.                 : null;
  189.         }
  190.         /**
  191.          * Get Stock max
  192.          *
  193.          * @return integer
  194.          */
  195.         public function getStockMax()
  196.         {
  197.             $this->_calc();
  198.             return count($this->stocks)
  199.                 ? max($this->stocks)
  200.                 : null;
  201.         }
  202.         /**
  203.          * Get StockUnlimited min
  204.          *
  205.          * @return integer
  206.          */
  207.         public function getStockUnlimitedMin()
  208.         {
  209.             $this->_calc();
  210.             return count($this->stockUnlimiteds)
  211.                 ? min($this->stockUnlimiteds)
  212.                 : null;
  213.         }
  214.         /**
  215.          * Get StockUnlimited max
  216.          *
  217.          * @return integer
  218.          */
  219.         public function getStockUnlimitedMax()
  220.         {
  221.             $this->_calc();
  222.             return count($this->stockUnlimiteds)
  223.                 ? max($this->stockUnlimiteds)
  224.                 : null;
  225.         }
  226.         /**
  227.          * Get Price01 min
  228.          *
  229.          * @return integer
  230.          */
  231.         public function getPrice01Min()
  232.         {
  233.             $this->_calc();
  234.             if (count($this->price01) == 0) {
  235.                 return null;
  236.             }
  237.             return min($this->price01);
  238.         }
  239.         /**
  240.          * Get Price01 max
  241.          *
  242.          * @return integer
  243.          */
  244.         public function getPrice01Max()
  245.         {
  246.             $this->_calc();
  247.             if (count($this->price01) == 0) {
  248.                 return null;
  249.             }
  250.             return max($this->price01);
  251.         }
  252.         /**
  253.          * Get Price02 min
  254.          *
  255.          * @return integer
  256.          */
  257.         public function getPrice02Min()
  258.         {
  259.             $this->_calc();
  260.             return count($this->price02)
  261.                 ? min($this->price02)
  262.                 : null;
  263.         }
  264.         /**
  265.          * Get Price02 max
  266.          *
  267.          * @return integer
  268.          */
  269.         public function getPrice02Max()
  270.         {
  271.             $this->_calc();
  272.             return count($this->price02)
  273.                 ? max($this->price02)
  274.                 : null;
  275.         }
  276.         /**
  277.          * Get Price01IncTax min
  278.          *
  279.          * @return integer
  280.          */
  281.         public function getPrice01IncTaxMin()
  282.         {
  283.             $this->_calc();
  284.             return count($this->price01IncTaxs)
  285.                 ? min($this->price01IncTaxs)
  286.                 : null;
  287.         }
  288.         /**
  289.          * Get Price01IncTax max
  290.          *
  291.          * @return integer
  292.          */
  293.         public function getPrice01IncTaxMax()
  294.         {
  295.             $this->_calc();
  296.             return count($this->price01IncTaxs)
  297.                 ? max($this->price01IncTaxs)
  298.                 : null;
  299.         }
  300.         /**
  301.          * Get Price02IncTax min
  302.          *
  303.          * @return integer
  304.          */
  305.         public function getPrice02IncTaxMin()
  306.         {
  307.             $this->_calc();
  308.             return count($this->price02IncTaxs)
  309.                 ? min($this->price02IncTaxs)
  310.                 : null;
  311.         }
  312.         /**
  313.          * Get Price02IncTax max
  314.          *
  315.          * @return integer
  316.          */
  317.         public function getPrice02IncTaxMax()
  318.         {
  319.             $this->_calc();
  320.             return count($this->price02IncTaxs)
  321.                 ? max($this->price02IncTaxs)
  322.                 : null;
  323.         }
  324.         /**
  325.          * Get Product_code min
  326.          *
  327.          * @return integer
  328.          */
  329.         public function getCodeMin()
  330.         {
  331.             $this->_calc();
  332.             $codes = [];
  333.             foreach ($this->codes as $code) {
  334.                 if (!is_null($code)) {
  335.                     $codes[] = $code;
  336.                 }
  337.             }
  338.             return count($codes) ? min($codes) : null;
  339.         }
  340.         /**
  341.          * Get Product_code max
  342.          *
  343.          * @return integer
  344.          */
  345.         public function getCodeMax()
  346.         {
  347.             $this->_calc();
  348.             $codes = [];
  349.             foreach ($this->codes as $code) {
  350.                 if (!is_null($code)) {
  351.                     $codes[] = $code;
  352.                 }
  353.             }
  354.             return count($codes) ? max($codes) : null;
  355.         }
  356.         public function getMainListImage()
  357.         {
  358.             $ProductImages $this->getProductImage();
  359.             return $ProductImages->isEmpty() ? null $ProductImages[0];
  360.         }
  361.         public function getMainFileName()
  362.         {
  363.             if (count($this->ProductImage) > 0) {
  364.                 return $this->ProductImage[0];
  365.             } else {
  366.                 return null;
  367.             }
  368.         }
  369.         public function hasProductClass()
  370.         {
  371.             foreach ($this->ProductClasses as $ProductClass) {
  372.                 if (!$ProductClass->isVisible()) {
  373.                     continue;
  374.                 }
  375.                 if (!is_null($ProductClass->getClassCategory1())) {
  376.                     return true;
  377.                 }
  378.             }
  379.             return false;
  380.         }
  381.         /**
  382.          * @var integer
  383.          *
  384.          * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  385.          * @ORM\Id
  386.          * @ORM\GeneratedValue(strategy="IDENTITY")
  387.          */
  388.         private $id;
  389.         /**
  390.          * @var string
  391.          *
  392.          * @ORM\Column(name="name", type="string", length=255)
  393.          */
  394.         private $name;
  395.         /**
  396.          * @var string|null
  397.          *
  398.          * @ORM\Column(name="note", type="text", nullable=true)
  399.          */
  400.         private $note;
  401.         /**
  402.          * @var string|null
  403.          *
  404.          * @ORM\Column(name="description_list", type="text", nullable=true)
  405.          */
  406.         private $description_list;
  407.         /**
  408.          * @var string|null
  409.          *
  410.          * @ORM\Column(name="description_detail", type="text", nullable=true)
  411.          */
  412.         private $description_detail;
  413.         /**
  414.          * @var string|null
  415.          *
  416.          * @ORM\Column(name="search_word", type="text", nullable=true)
  417.          */
  418.         private $search_word;
  419.         /**
  420.          * @var string|null
  421.          *
  422.          * @ORM\Column(name="free_area", type="text", nullable=true)
  423.          */
  424.         private $free_area;
  425.         /**
  426.          * @var \DateTime
  427.          *
  428.          * @ORM\Column(name="create_date", type="datetimetz")
  429.          */
  430.         private $create_date;
  431.         /**
  432.          * @var \DateTime
  433.          *
  434.          * @ORM\Column(name="update_date", type="datetimetz")
  435.          */
  436.         private $update_date;
  437.         /**
  438.          * @var \Doctrine\Common\Collections\Collection
  439.          *
  440.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductCategory", mappedBy="Product", cascade={"persist","remove"})
  441.          */
  442.         private $ProductCategories;
  443.         /**
  444.          * @var \Doctrine\Common\Collections\Collection
  445.          *
  446.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductClass", mappedBy="Product", cascade={"persist","remove"})
  447.          */
  448.         private $ProductClasses;
  449.         /**
  450.          * @var \Doctrine\Common\Collections\Collection
  451.          *
  452.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductImage", mappedBy="Product", cascade={"remove"})
  453.          * @ORM\OrderBy({
  454.          *     "sort_no"="ASC"
  455.          * })
  456.          */
  457.         private $ProductImage;
  458.         /**
  459.          * @var \Doctrine\Common\Collections\Collection
  460.          *
  461.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductTag", mappedBy="Product", cascade={"remove"})
  462.          */
  463.         private $ProductTag;
  464.         /**
  465.          * @var \Doctrine\Common\Collections\Collection
  466.          *
  467.          * @ORM\OneToMany(targetEntity="Eccube\Entity\CustomerFavoriteProduct", mappedBy="Product")
  468.          */
  469.         private $CustomerFavoriteProducts;
  470.         /**
  471.          * @var \Eccube\Entity\Member
  472.          *
  473.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
  474.          * @ORM\JoinColumns({
  475.          *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
  476.          * })
  477.          */
  478.         private $Creator;
  479.         /**
  480.          * @var \Eccube\Entity\Master\ProductStatus
  481.          *
  482.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\ProductStatus")
  483.          * @ORM\JoinColumns({
  484.          *   @ORM\JoinColumn(name="product_status_id", referencedColumnName="id")
  485.          * })
  486.          */
  487.         private $Status;
  488.         /**
  489.          * Constructor
  490.          */
  491.         public function __construct()
  492.         {
  493.             $this->ProductCategories = new \Doctrine\Common\Collections\ArrayCollection();
  494.             $this->ProductClasses = new \Doctrine\Common\Collections\ArrayCollection();
  495.             $this->ProductImage = new \Doctrine\Common\Collections\ArrayCollection();
  496.             $this->ProductTag = new \Doctrine\Common\Collections\ArrayCollection();
  497.             $this->CustomerFavoriteProducts = new \Doctrine\Common\Collections\ArrayCollection();
  498.         }
  499.         public function __clone()
  500.         {
  501.             $this->id null;
  502.         }
  503.         public function copy()
  504.         {
  505.             // コピー対象外
  506.             $this->CustomerFavoriteProducts = new ArrayCollection();
  507.             $Categories $this->getProductCategories();
  508.             $this->ProductCategories = new ArrayCollection();
  509.             foreach ($Categories as $Category) {
  510.                 $CopyCategory = clone $Category;
  511.                 $this->addProductCategory($CopyCategory);
  512.                 $CopyCategory->setProduct($this);
  513.             }
  514.             $Classes $this->getProductClasses();
  515.             $this->ProductClasses = new ArrayCollection();
  516.             foreach ($Classes as $Class) {
  517.                 $CopyClass = clone $Class;
  518.                 $this->addProductClass($CopyClass);
  519.                 $CopyClass->setProduct($this);
  520.             }
  521.             $Images $this->getProductImage();
  522.             $this->ProductImage = new ArrayCollection();
  523.             foreach ($Images as $Image) {
  524.                 $CloneImage = clone $Image;
  525.                 $this->addProductImage($CloneImage);
  526.                 $CloneImage->setProduct($this);
  527.             }
  528.             $Tags $this->getProductTag();
  529.             $this->ProductTag = new ArrayCollection();
  530.             foreach ($Tags as $Tag) {
  531.                 $CloneTag = clone $Tag;
  532.                 $this->addProductTag($CloneTag);
  533.                 $CloneTag->setProduct($this);
  534.             }
  535.             return $this;
  536.         }
  537.         /**
  538.          * Get id.
  539.          *
  540.          * @return int
  541.          */
  542.         public function getId()
  543.         {
  544.             return $this->id;
  545.         }
  546.         /**
  547.          * Set name.
  548.          *
  549.          * @param string $name
  550.          *
  551.          * @return Product
  552.          */
  553.         public function setName($name)
  554.         {
  555.             $this->name $name;
  556.             return $this;
  557.         }
  558.         /**
  559.          * Get name.
  560.          *
  561.          * @return string
  562.          */
  563.         public function getName()
  564.         {
  565.             return $this->name;
  566.         }
  567.         /**
  568.          * Set note.
  569.          *
  570.          * @param string|null $note
  571.          *
  572.          * @return Product
  573.          */
  574.         public function setNote($note null)
  575.         {
  576.             $this->note $note;
  577.             return $this;
  578.         }
  579.         /**
  580.          * Get note.
  581.          *
  582.          * @return string|null
  583.          */
  584.         public function getNote()
  585.         {
  586.             return $this->note;
  587.         }
  588.         /**
  589.          * Set descriptionList.
  590.          *
  591.          * @param string|null $descriptionList
  592.          *
  593.          * @return Product
  594.          */
  595.         public function setDescriptionList($descriptionList null)
  596.         {
  597.             $this->description_list $descriptionList;
  598.             return $this;
  599.         }
  600.         /**
  601.          * Get descriptionList.
  602.          *
  603.          * @return string|null
  604.          */
  605.         public function getDescriptionList()
  606.         {
  607.             return $this->description_list;
  608.         }
  609.         /**
  610.          * Set descriptionDetail.
  611.          *
  612.          * @param string|null $descriptionDetail
  613.          *
  614.          * @return Product
  615.          */
  616.         public function setDescriptionDetail($descriptionDetail null)
  617.         {
  618.             $this->description_detail $descriptionDetail;
  619.             return $this;
  620.         }
  621.         /**
  622.          * Get descriptionDetail.
  623.          *
  624.          * @return string|null
  625.          */
  626.         public function getDescriptionDetail()
  627.         {
  628.             return $this->description_detail;
  629.         }
  630.         /**
  631.          * Set searchWord.
  632.          *
  633.          * @param string|null $searchWord
  634.          *
  635.          * @return Product
  636.          */
  637.         public function setSearchWord($searchWord null)
  638.         {
  639.             $this->search_word $searchWord;
  640.             return $this;
  641.         }
  642.         /**
  643.          * Get searchWord.
  644.          *
  645.          * @return string|null
  646.          */
  647.         public function getSearchWord()
  648.         {
  649.             return $this->search_word;
  650.         }
  651.         /**
  652.          * Set freeArea.
  653.          *
  654.          * @param string|null $freeArea
  655.          *
  656.          * @return Product
  657.          */
  658.         public function setFreeArea($freeArea null)
  659.         {
  660.             $this->free_area $freeArea;
  661.             return $this;
  662.         }
  663.         /**
  664.          * Get freeArea.
  665.          *
  666.          * @return string|null
  667.          */
  668.         public function getFreeArea()
  669.         {
  670.             return $this->free_area;
  671.         }
  672.         /**
  673.          * Set createDate.
  674.          *
  675.          * @param \DateTime $createDate
  676.          *
  677.          * @return Product
  678.          */
  679.         public function setCreateDate($createDate)
  680.         {
  681.             $this->create_date $createDate;
  682.             return $this;
  683.         }
  684.         /**
  685.          * Get createDate.
  686.          *
  687.          * @return \DateTime
  688.          */
  689.         public function getCreateDate()
  690.         {
  691.             return $this->create_date;
  692.         }
  693.         /**
  694.          * Set updateDate.
  695.          *
  696.          * @param \DateTime $updateDate
  697.          *
  698.          * @return Product
  699.          */
  700.         public function setUpdateDate($updateDate)
  701.         {
  702.             $this->update_date $updateDate;
  703.             return $this;
  704.         }
  705.         /**
  706.          * Get updateDate.
  707.          *
  708.          * @return \DateTime
  709.          */
  710.         public function getUpdateDate()
  711.         {
  712.             return $this->update_date;
  713.         }
  714.         /**
  715.          * Add productCategory.
  716.          *
  717.          * @param \Eccube\Entity\ProductCategory $productCategory
  718.          *
  719.          * @return Product
  720.          */
  721.         public function addProductCategory(ProductCategory $productCategory)
  722.         {
  723.             $this->ProductCategories[] = $productCategory;
  724.             return $this;
  725.         }
  726.         /**
  727.          * Remove productCategory.
  728.          *
  729.          * @param \Eccube\Entity\ProductCategory $productCategory
  730.          *
  731.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  732.          */
  733.         public function removeProductCategory(ProductCategory $productCategory)
  734.         {
  735.             return $this->ProductCategories->removeElement($productCategory);
  736.         }
  737.         /**
  738.          * Get productCategories.
  739.          *
  740.          * @return \Doctrine\Common\Collections\Collection
  741.          */
  742.         public function getProductCategories()
  743.         {
  744.             return $this->ProductCategories;
  745.         }
  746.         /**
  747.          * Add productClass.
  748.          *
  749.          * @param \Eccube\Entity\ProductClass $productClass
  750.          *
  751.          * @return Product
  752.          */
  753.         public function addProductClass(ProductClass $productClass)
  754.         {
  755.             $this->ProductClasses[] = $productClass;
  756.             return $this;
  757.         }
  758.         /**
  759.          * Remove productClass.
  760.          *
  761.          * @param \Eccube\Entity\ProductClass $productClass
  762.          *
  763.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  764.          */
  765.         public function removeProductClass(ProductClass $productClass)
  766.         {
  767.             return $this->ProductClasses->removeElement($productClass);
  768.         }
  769.         /**
  770.          * Get productClasses.
  771.          *
  772.          * @return \Doctrine\Common\Collections\Collection
  773.          */
  774.         public function getProductClasses()
  775.         {
  776.             return $this->ProductClasses;
  777.         }
  778.         /**
  779.          * Add productImage.
  780.          *
  781.          * @param \Eccube\Entity\ProductImage $productImage
  782.          *
  783.          * @return Product
  784.          */
  785.         public function addProductImage(ProductImage $productImage)
  786.         {
  787.             $this->ProductImage[] = $productImage;
  788.             return $this;
  789.         }
  790.         /**
  791.          * Remove productImage.
  792.          *
  793.          * @param \Eccube\Entity\ProductImage $productImage
  794.          *
  795.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  796.          */
  797.         public function removeProductImage(ProductImage $productImage)
  798.         {
  799.             return $this->ProductImage->removeElement($productImage);
  800.         }
  801.         /**
  802.          * Get productImage.
  803.          *
  804.          * @return \Doctrine\Common\Collections\Collection
  805.          */
  806.         public function getProductImage()
  807.         {
  808.             return $this->ProductImage;
  809.         }
  810.         /**
  811.          * Add productTag.
  812.          *
  813.          * @param \Eccube\Entity\ProductTag $productTag
  814.          *
  815.          * @return Product
  816.          */
  817.         public function addProductTag(ProductTag $productTag)
  818.         {
  819.             $this->ProductTag[] = $productTag;
  820.             return $this;
  821.         }
  822.         /**
  823.          * Remove productTag.
  824.          *
  825.          * @param \Eccube\Entity\ProductTag $productTag
  826.          *
  827.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  828.          */
  829.         public function removeProductTag(ProductTag $productTag)
  830.         {
  831.             return $this->ProductTag->removeElement($productTag);
  832.         }
  833.         /**
  834.          * Get productTag.
  835.          *
  836.          * @return \Doctrine\Common\Collections\Collection
  837.          */
  838.         public function getProductTag()
  839.         {
  840.             return $this->ProductTag;
  841.         }
  842.         /**
  843.          * Get Tag
  844.          * フロント側タグsort_no順の配列を作成する
  845.          *
  846.          * @return []Tag
  847.          */
  848.         public function getTags()
  849.         {
  850.             $tags = [];
  851.             foreach ($this->getProductTag() as $productTag) {
  852.                 $tags[] = $productTag->getTag();
  853.             }
  854.             usort($tags, function (Tag $tag1Tag $tag2) {
  855.                 return $tag1->getSortNo() < $tag2->getSortNo();
  856.             });
  857.             return $tags;
  858.         }
  859.         /**
  860.          * Add customerFavoriteProduct.
  861.          *
  862.          * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct
  863.          *
  864.          * @return Product
  865.          */
  866.         public function addCustomerFavoriteProduct(CustomerFavoriteProduct $customerFavoriteProduct)
  867.         {
  868.             $this->CustomerFavoriteProducts[] = $customerFavoriteProduct;
  869.             return $this;
  870.         }
  871.         /**
  872.          * Remove customerFavoriteProduct.
  873.          *
  874.          * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct
  875.          *
  876.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  877.          */
  878.         public function removeCustomerFavoriteProduct(CustomerFavoriteProduct $customerFavoriteProduct)
  879.         {
  880.             return $this->CustomerFavoriteProducts->removeElement($customerFavoriteProduct);
  881.         }
  882.         /**
  883.          * Get customerFavoriteProducts.
  884.          *
  885.          * @return \Doctrine\Common\Collections\Collection
  886.          */
  887.         public function getCustomerFavoriteProducts()
  888.         {
  889.             return $this->CustomerFavoriteProducts;
  890.         }
  891.         /**
  892.          * Set creator.
  893.          *
  894.          * @param \Eccube\Entity\Member|null $creator
  895.          *
  896.          * @return Product
  897.          */
  898.         public function setCreator(Member $creator null)
  899.         {
  900.             $this->Creator $creator;
  901.             return $this;
  902.         }
  903.         /**
  904.          * Get creator.
  905.          *
  906.          * @return \Eccube\Entity\Member|null
  907.          */
  908.         public function getCreator()
  909.         {
  910.             return $this->Creator;
  911.         }
  912.         /**
  913.          * Set status.
  914.          *
  915.          * @param \Eccube\Entity\Master\ProductStatus|null $status
  916.          *
  917.          * @return Product
  918.          */
  919.         public function setStatus(Master\ProductStatus $status null)
  920.         {
  921.             $this->Status $status;
  922.             return $this;
  923.         }
  924.         /**
  925.          * Get status.
  926.          *
  927.          * @return \Eccube\Entity\Master\ProductStatus|null
  928.          */
  929.         public function getStatus()
  930.         {
  931.             return $this->Status;
  932.         }
  933.     }