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