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\ProductPlus42\Entity\ProductTrait\Plugin\CustomerRank42\Entity\ProductTrait\Plugin\EccubePaymentLite42\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.                     // 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="search_word", type="text", nullable=true)
  417.          */
  418.         private $search_word;
  419.         /**
  420.          * @var string|null
  421.          *
  422.          * @ORM\Column(name="free_area", type="text", nullable=true)
  423.          */
  424.         private $free_area;
  425.         /**
  426.          * @var \DateTime
  427.          *
  428.          * @ORM\Column(name="create_date", type="datetimetz")
  429.          */
  430.         private $create_date;
  431.         /**
  432.          * @var \DateTime
  433.          *
  434.          * @ORM\Column(name="update_date", type="datetimetz")
  435.          */
  436.         private $update_date;
  437.         /**
  438.          * @var int
  439.          *
  440.          * @ORM\Column(name="del_flg", type="smallint", options={"default":0})
  441.          */
  442.         private $del_flg 0;
  443.         /**
  444.          * @var \Doctrine\Common\Collections\Collection
  445.          *
  446.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductCategory", mappedBy="Product", cascade={"persist","remove"})
  447.          */
  448.         private $ProductCategories;
  449.         /**
  450.          * @var \Doctrine\Common\Collections\Collection
  451.          *
  452.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductClass", mappedBy="Product", cascade={"persist","remove"})
  453.          */
  454.         private $ProductClasses;
  455.         /**
  456.          * @var \Doctrine\Common\Collections\Collection
  457.          *
  458.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductImage", mappedBy="Product", cascade={"remove"})
  459.          * @ORM\OrderBy({
  460.          *     "sort_no"="ASC"
  461.          * })
  462.          */
  463.         private $ProductImage;
  464.         /**
  465.          * @var \Doctrine\Common\Collections\Collection
  466.          *
  467.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductTag", mappedBy="Product", cascade={"remove"})
  468.          */
  469.         private $ProductTag;
  470.         /**
  471.          * @var \Doctrine\Common\Collections\Collection
  472.          *
  473.          * @ORM\OneToMany(targetEntity="Eccube\Entity\CustomerFavoriteProduct", mappedBy="Product")
  474.          */
  475.         private $CustomerFavoriteProducts;
  476.         /**
  477.          * @var \Eccube\Entity\Member
  478.          *
  479.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
  480.          * @ORM\JoinColumns({
  481.          *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
  482.          * })
  483.          */
  484.         private $Creator;
  485.         /**
  486.          * @var \Eccube\Entity\Master\ProductStatus
  487.          *
  488.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\ProductStatus")
  489.          * @ORM\JoinColumns({
  490.          *   @ORM\JoinColumn(name="product_status_id", referencedColumnName="id")
  491.          * })
  492.          */
  493.         private $Status;
  494.         /**
  495.          * Constructor
  496.          */
  497.         public function __construct()
  498.         {
  499.             $this->ProductCategories = new \Doctrine\Common\Collections\ArrayCollection();
  500.             $this->ProductClasses = new \Doctrine\Common\Collections\ArrayCollection();
  501.             $this->ProductImage = new \Doctrine\Common\Collections\ArrayCollection();
  502.             $this->ProductTag = new \Doctrine\Common\Collections\ArrayCollection();
  503.             $this->CustomerFavoriteProducts = new \Doctrine\Common\Collections\ArrayCollection();
  504.         }
  505.         public function __clone()
  506.         {
  507.             $this->id null;
  508.         }
  509.         public function copy()
  510.         {
  511.             // コピー対象外
  512.             $this->CustomerFavoriteProducts = new ArrayCollection();
  513.             $Categories $this->getProductCategories();
  514.             $this->ProductCategories = new ArrayCollection();
  515.             foreach ($Categories as $Category) {
  516.                 $CopyCategory = clone $Category;
  517.                 $this->addProductCategory($CopyCategory);
  518.                 $CopyCategory->setProduct($this);
  519.             }
  520.             $Classes $this->getProductClasses();
  521.             $this->ProductClasses = new ArrayCollection();
  522.             foreach ($Classes as $Class) {
  523.                 $CopyClass = clone $Class;
  524.                 $this->addProductClass($CopyClass);
  525.                 $CopyClass->setProduct($this);
  526.             }
  527.             $Images $this->getProductImage();
  528.             $this->ProductImage = new ArrayCollection();
  529.             foreach ($Images as $Image) {
  530.                 $CloneImage = clone $Image;
  531.                 $this->addProductImage($CloneImage);
  532.                 $CloneImage->setProduct($this);
  533.             }
  534.             $Tags $this->getProductTag();
  535.             $this->ProductTag = new ArrayCollection();
  536.             foreach ($Tags as $Tag) {
  537.                 $CloneTag = clone $Tag;
  538.                 $this->addProductTag($CloneTag);
  539.                 $CloneTag->setProduct($this);
  540.             }
  541.             return $this;
  542.         }
  543.         /**
  544.          * Set id.
  545.          *
  546.          * @return int
  547.          * @return Product
  548.          */
  549.         public function setId($id)
  550.         {
  551.             $this->id $id;
  552.             return $this;
  553.         }
  554.         /**
  555.          * Get id.
  556.          *
  557.          * @return int
  558.          */
  559.         public function getId()
  560.         {
  561.             return $this->id;
  562.         }
  563.         /**
  564.          * Set name.
  565.          *
  566.          * @param string $name
  567.          *
  568.          * @return Product
  569.          */
  570.         public function setName($name)
  571.         {
  572.             $this->name $name;
  573.             return $this;
  574.         }
  575.         /**
  576.          * Get name.
  577.          *
  578.          * @return string
  579.          */
  580.         public function getName()
  581.         {
  582.             return $this->name;
  583.         }
  584.         /**
  585.          * Set note.
  586.          *
  587.          * @param string|null $note
  588.          *
  589.          * @return Product
  590.          */
  591.         public function setNote($note null)
  592.         {
  593.             $this->note $note;
  594.             return $this;
  595.         }
  596.         /**
  597.          * Get note.
  598.          *
  599.          * @return string|null
  600.          */
  601.         public function getNote()
  602.         {
  603.             return $this->note;
  604.         }
  605.         /**
  606.          * Set descriptionList.
  607.          *
  608.          * @param string|null $descriptionList
  609.          *
  610.          * @return Product
  611.          */
  612.         public function setDescriptionList($descriptionList null)
  613.         {
  614.             $this->description_list $descriptionList;
  615.             return $this;
  616.         }
  617.         /**
  618.          * Get descriptionList.
  619.          *
  620.          * @return string|null
  621.          */
  622.         public function getDescriptionList()
  623.         {
  624.             return $this->description_list;
  625.         }
  626.         /**
  627.          * Set descriptionDetail.
  628.          *
  629.          * @param string|null $descriptionDetail
  630.          *
  631.          * @return Product
  632.          */
  633.         public function setDescriptionDetail($descriptionDetail null)
  634.         {
  635.             $this->description_detail $descriptionDetail;
  636.             return $this;
  637.         }
  638.         /**
  639.          * Get descriptionDetail.
  640.          *
  641.          * @return string|null
  642.          */
  643.         public function getDescriptionDetail()
  644.         {
  645.             return $this->description_detail;
  646.         }
  647.         /**
  648.          * Set searchWord.
  649.          *
  650.          * @param string|null $searchWord
  651.          *
  652.          * @return Product
  653.          */
  654.         public function setSearchWord($searchWord null)
  655.         {
  656.             $this->search_word $searchWord;
  657.             return $this;
  658.         }
  659.         /**
  660.          * Get searchWord.
  661.          *
  662.          * @return string|null
  663.          */
  664.         public function getSearchWord()
  665.         {
  666.             return $this->search_word;
  667.         }
  668.         /**
  669.          * Set freeArea.
  670.          *
  671.          * @param string|null $freeArea
  672.          *
  673.          * @return Product
  674.          */
  675.         public function setFreeArea($freeArea null)
  676.         {
  677.             $this->free_area $freeArea;
  678.             return $this;
  679.         }
  680.         /**
  681.          * Get freeArea.
  682.          *
  683.          * @return string|null
  684.          */
  685.         public function getFreeArea()
  686.         {
  687.             return $this->free_area;
  688.         }
  689.         /**
  690.          * Set createDate.
  691.          *
  692.          * @param \DateTime $createDate
  693.          *
  694.          * @return Product
  695.          */
  696.         public function setCreateDate($createDate)
  697.         {
  698.             $this->create_date $createDate;
  699.             return $this;
  700.         }
  701.         /**
  702.          * Get createDate.
  703.          *
  704.          * @return \DateTime
  705.          */
  706.         public function getCreateDate()
  707.         {
  708.             return $this->create_date;
  709.         }
  710.         /**
  711.          * Set updateDate.
  712.          *
  713.          * @param \DateTime $updateDate
  714.          *
  715.          * @return Product
  716.          */
  717.         public function setUpdateDate($updateDate)
  718.         {
  719.             $this->update_date $updateDate;
  720.             return $this;
  721.         }
  722.         /**
  723.          * Get updateDate.
  724.          *
  725.          * @return \DateTime
  726.          */
  727.         public function getUpdateDate()
  728.         {
  729.             return $this->update_date;
  730.         }
  731.         /**
  732.          * Set delFlg.
  733.          *
  734.          * @param int $delFlg
  735.          *
  736.          * @return Product
  737.          */
  738.         public function setDelFlg($delFlg)
  739.         {
  740.             $this->del_flg $delFlg;
  741.             return $this;
  742.         }
  743.         /**
  744.          * Get delFlg.
  745.          *
  746.          * @return int
  747.          */
  748.         public function getDelFlg()
  749.         {
  750.             return $this->del_flg;
  751.         }
  752.         /**
  753.          * Is deleted.
  754.          *
  755.          * @return bool
  756.          */
  757.         public function isDeleted()
  758.         {
  759.             return $this->del_flg === 1;
  760.         }
  761.         /**
  762.          * Add productCategory.
  763.          *
  764.          * @param \Eccube\Entity\ProductCategory $productCategory
  765.          *
  766.          * @return Product
  767.          */
  768.         public function addProductCategory(ProductCategory $productCategory)
  769.         {
  770.             $this->ProductCategories[] = $productCategory;
  771.             return $this;
  772.         }
  773.         /**
  774.          * Remove productCategory.
  775.          *
  776.          * @param \Eccube\Entity\ProductCategory $productCategory
  777.          *
  778.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  779.          */
  780.         public function removeProductCategory(ProductCategory $productCategory)
  781.         {
  782.             return $this->ProductCategories->removeElement($productCategory);
  783.         }
  784.         /**
  785.          * Get productCategories.
  786.          *
  787.          * @return \Doctrine\Common\Collections\Collection
  788.          */
  789.         public function getProductCategories()
  790.         {
  791.             return $this->ProductCategories;
  792.         }
  793.         /**
  794.          * Add productClass.
  795.          *
  796.          * @param \Eccube\Entity\ProductClass $productClass
  797.          *
  798.          * @return Product
  799.          */
  800.         public function addProductClass(ProductClass $productClass)
  801.         {
  802.             $this->ProductClasses[] = $productClass;
  803.             return $this;
  804.         }
  805.         /**
  806.          * Remove productClass.
  807.          *
  808.          * @param \Eccube\Entity\ProductClass $productClass
  809.          *
  810.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  811.          */
  812.         public function removeProductClass(ProductClass $productClass)
  813.         {
  814.             return $this->ProductClasses->removeElement($productClass);
  815.         }
  816.         /**
  817.          * Get productClasses.
  818.          *
  819.          * @return \Doctrine\Common\Collections\Collection
  820.          */
  821.         public function getProductClasses()
  822.         {
  823.             return $this->ProductClasses;
  824.         }
  825.         /**
  826.          * Add productImage.
  827.          *
  828.          * @param \Eccube\Entity\ProductImage $productImage
  829.          *
  830.          * @return Product
  831.          */
  832.         public function addProductImage(ProductImage $productImage)
  833.         {
  834.             $this->ProductImage[] = $productImage;
  835.             return $this;
  836.         }
  837.         /**
  838.          * Remove productImage.
  839.          *
  840.          * @param \Eccube\Entity\ProductImage $productImage
  841.          *
  842.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  843.          */
  844.         public function removeProductImage(ProductImage $productImage)
  845.         {
  846.             return $this->ProductImage->removeElement($productImage);
  847.         }
  848.         /**
  849.          * Get productImage.
  850.          *
  851.          * @return \Doctrine\Common\Collections\Collection
  852.          */
  853.         public function getProductImage()
  854.         {
  855.             return $this->ProductImage;
  856.         }
  857.         /**
  858.          * Add productTag.
  859.          *
  860.          * @param \Eccube\Entity\ProductTag $productTag
  861.          *
  862.          * @return Product
  863.          */
  864.         public function addProductTag(ProductTag $productTag)
  865.         {
  866.             $this->ProductTag[] = $productTag;
  867.             return $this;
  868.         }
  869.         /**
  870.          * Remove productTag.
  871.          *
  872.          * @param \Eccube\Entity\ProductTag $productTag
  873.          *
  874.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  875.          */
  876.         public function removeProductTag(ProductTag $productTag)
  877.         {
  878.             return $this->ProductTag->removeElement($productTag);
  879.         }
  880.         /**
  881.          * Get productTag.
  882.          *
  883.          * @return \Doctrine\Common\Collections\Collection
  884.          */
  885.         public function getProductTag()
  886.         {
  887.             return $this->ProductTag;
  888.         }
  889.         /**
  890.          * Get Tag
  891.          * フロント側タグsort_no順の配列を作成する
  892.          *
  893.          * @return []Tag
  894.          */
  895.         public function getTags()
  896.         {
  897.             $tags = [];
  898.             foreach ($this->getProductTag() as $productTag) {
  899.                 $tags[] = $productTag->getTag();
  900.             }
  901.             usort($tags, function (Tag $tag1Tag $tag2) {
  902.                 return $tag1->getSortNo() < $tag2->getSortNo();
  903.             });
  904.             return $tags;
  905.         }
  906.         /**
  907.          * Add customerFavoriteProduct.
  908.          *
  909.          * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct
  910.          *
  911.          * @return Product
  912.          */
  913.         public function addCustomerFavoriteProduct(CustomerFavoriteProduct $customerFavoriteProduct)
  914.         {
  915.             $this->CustomerFavoriteProducts[] = $customerFavoriteProduct;
  916.             return $this;
  917.         }
  918.         /**
  919.          * Remove customerFavoriteProduct.
  920.          *
  921.          * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct
  922.          *
  923.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  924.          */
  925.         public function removeCustomerFavoriteProduct(CustomerFavoriteProduct $customerFavoriteProduct)
  926.         {
  927.             return $this->CustomerFavoriteProducts->removeElement($customerFavoriteProduct);
  928.         }
  929.         /**
  930.          * Get customerFavoriteProducts.
  931.          *
  932.          * @return \Doctrine\Common\Collections\Collection
  933.          */
  934.         public function getCustomerFavoriteProducts()
  935.         {
  936.             return $this->CustomerFavoriteProducts;
  937.         }
  938.         /**
  939.          * Set creator.
  940.          *
  941.          * @param \Eccube\Entity\Member|null $creator
  942.          *
  943.          * @return Product
  944.          */
  945.         public function setCreator(Member $creator null)
  946.         {
  947.             $this->Creator $creator;
  948.             return $this;
  949.         }
  950.         /**
  951.          * Get creator.
  952.          *
  953.          * @return \Eccube\Entity\Member|null
  954.          */
  955.         public function getCreator()
  956.         {
  957.             return $this->Creator;
  958.         }
  959.         /**
  960.          * Set status.
  961.          *
  962.          * @param \Eccube\Entity\Master\ProductStatus|null $status
  963.          *
  964.          * @return Product
  965.          */
  966.         public function setStatus(Master\ProductStatus $status null)
  967.         {
  968.             $this->Status $status;
  969.             return $this;
  970.         }
  971.         /**
  972.          * Get status.
  973.          *
  974.          * @return \Eccube\Entity\Master\ProductStatus|null
  975.          */
  976.         public function getStatus()
  977.         {
  978.             return $this->Status;
  979.         }
  980.     }