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