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