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