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

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