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;
  27.         private $_calc false;
  28.         private $stockFinds = [];
  29.         private $stocks = [];
  30.         private $stockUnlimiteds = [];
  31.         private $price01 = [];
  32.         private $price02 = [];
  33.         private $companyPrice = [];
  34.         private $price01IncTaxs = [];
  35.         private $price02IncTaxs = [];
  36.         private $codes = [];
  37.         private $classCategories1 = [];
  38.         private $classCategories2 = [];
  39.         private $className1;
  40.         private $className2;
  41.         /**
  42.          * @return string
  43.          */
  44.         public function __toString()
  45.         {
  46.             return (string) $this->getName();
  47.         }
  48.         public function _calc()
  49.         {
  50.             if (!$this->_calc) {
  51.                 $i 0;
  52.                 foreach ($this->getProductClasses() as $ProductClass) {
  53.                     /* @var $ProductClass \Eccube\Entity\ProductClass */
  54.                     // stock_find
  55.                     if ($ProductClass->isVisible() == false) {
  56.                         continue;
  57.                     }
  58.                     $ClassCategory1 $ProductClass->getClassCategory1();
  59.                     $ClassCategory2 $ProductClass->getClassCategory2();
  60.                     if ($ClassCategory1 && !$ClassCategory1->isVisible()) {
  61.                         continue;
  62.                     }
  63.                     if ($ClassCategory2 && !$ClassCategory2->isVisible()) {
  64.                         continue;
  65.                     }
  66.                     // stock_find
  67.                     $this->stockFinds[] = $ProductClass->getStockFind();
  68.                     // stock
  69.                     $this->stocks[] = $ProductClass->getStock();
  70.                     // stock_unlimited
  71.                     $this->stockUnlimiteds[] = $ProductClass->isStockUnlimited();
  72.                     // price01
  73.                     if (!is_null($ProductClass->getPrice01())) {
  74.                         $this->price01[] = $ProductClass->getPrice01();
  75.                         // price01IncTax
  76.                         $this->price01IncTaxs[] = $ProductClass->getPrice01IncTax();
  77.                     }
  78.                     // price02
  79.                     $this->price02[] = $ProductClass->getPrice02();
  80.                     // price02IncTax
  81.                     $this->price02IncTaxs[] = $ProductClass->getPrice02IncTax();
  82.                     //companyPrice
  83.                     $this->companyPrice[] = $ProductClass->getCompanyPrice();
  84.                     // product_code
  85.                     $this->codes[] = $ProductClass->getCode();
  86.                     if ($i === 0) {
  87.                         if ($ProductClass->getClassCategory1() && $ProductClass->getClassCategory1()->getId()) {
  88.                             $this->className1 $ProductClass->getClassCategory1()->getClassName()->getName();
  89.                         }
  90.                         if ($ProductClass->getClassCategory2() && $ProductClass->getClassCategory2()->getId()) {
  91.                             $this->className2 $ProductClass->getClassCategory2()->getClassName()->getName();
  92.                         }
  93.                     }
  94.                     if ($ProductClass->getClassCategory1()) {
  95.                         $classCategoryId1 $ProductClass->getClassCategory1()->getId();
  96.                         if (!empty($classCategoryId1)) {
  97.                             if ($ProductClass->getClassCategory2()) {
  98.                                 $this->classCategories1[$ProductClass->getClassCategory1()->getId()] = $ProductClass->getClassCategory1()->getName();
  99.                                 $this->classCategories2[$ProductClass->getClassCategory1()->getId()][$ProductClass->getClassCategory2()->getId()] = $ProductClass->getClassCategory2()->getName();
  100.                             } else {
  101.                                 $this->classCategories1[$ProductClass->getClassCategory1()->getId()] = $ProductClass->getClassCategory1()->getName().($ProductClass->getStockFind() ? '' trans('front.product.out_of_stock_label'));
  102.                             }
  103.                         }
  104.                     }
  105.                     $i++;
  106.                 }
  107.                 $this->_calc true;
  108.             }
  109.         }
  110.         /**
  111.          * Is Enable
  112.          *
  113.          * @return bool
  114.          *
  115.          * @deprecated
  116.          */
  117.         public function isEnable()
  118.         {
  119.             return $this->getStatus()->getId() === \Eccube\Entity\Master\ProductStatus::DISPLAY_SHOW true false;
  120.         }
  121.         /**
  122.          * Get ClassName1
  123.          *
  124.          * @return string
  125.          */
  126.         public function getClassName1()
  127.         {
  128.             $this->_calc();
  129.             return $this->className1;
  130.         }
  131.         /**
  132.          * Get ClassName2
  133.          *
  134.          * @return string
  135.          */
  136.         public function getClassName2()
  137.         {
  138.             $this->_calc();
  139.             return $this->className2;
  140.         }
  141.         /**
  142.          * Get getClassCategories1
  143.          *
  144.          * @return array
  145.          */
  146.         public function getClassCategories1()
  147.         {
  148.             $this->_calc();
  149.             return $this->classCategories1;
  150.         }
  151.         public function getClassCategories1AsFlip()
  152.         {
  153.             return array_flip($this->getClassCategories1());
  154.         }
  155.         /**
  156.          * Get getClassCategories2
  157.          *
  158.          * @return array
  159.          */
  160.         public function getClassCategories2($class_category1)
  161.         {
  162.             $this->_calc();
  163.             return isset($this->classCategories2[$class_category1]) ? $this->classCategories2[$class_category1] : [];
  164.         }
  165.         public function getClassCategories2AsFlip($class_category1)
  166.         {
  167.             return array_flip($this->getClassCategories2($class_category1));
  168.         }
  169.         /**
  170.          * Get StockFind
  171.          *
  172.          * @return bool
  173.          */
  174.         public function getStockFind()
  175.         {
  176.             $this->_calc();
  177.             return count($this->stockFinds)
  178.                 ? max($this->stockFinds)
  179.                 : null;
  180.         }
  181.         /**
  182.          * Get Stock min
  183.          *
  184.          * @return integer
  185.          */
  186.         public function getStockMin()
  187.         {
  188.             $this->_calc();
  189.             return count($this->stocks)
  190.                 ? min($this->stocks)
  191.                 : null;
  192.         }
  193.         /**
  194.          * Get Stock max
  195.          *
  196.          * @return integer
  197.          */
  198.         public function getStockMax()
  199.         {
  200.             $this->_calc();
  201.             return count($this->stocks)
  202.                 ? max($this->stocks)
  203.                 : null;
  204.         }
  205.         /**
  206.          * Get StockUnlimited min
  207.          *
  208.          * @return integer
  209.          */
  210.         public function getStockUnlimitedMin()
  211.         {
  212.             $this->_calc();
  213.             return count($this->stockUnlimiteds)
  214.                 ? min($this->stockUnlimiteds)
  215.                 : null;
  216.         }
  217.         /**
  218.          * Get StockUnlimited max
  219.          *
  220.          * @return integer
  221.          */
  222.         public function getStockUnlimitedMax()
  223.         {
  224.             $this->_calc();
  225.             return count($this->stockUnlimiteds)
  226.                 ? max($this->stockUnlimiteds)
  227.                 : null;
  228.         }
  229.         /**
  230.          * Get Price01 min
  231.          *
  232.          * @return integer
  233.          */
  234.         public function getPrice01Min()
  235.         {
  236.             $this->_calc();
  237.             if (count($this->price01) == 0) {
  238.                 return null;
  239.             }
  240.             return min($this->price01);
  241.         }
  242.         /**
  243.          * Get Price01 max
  244.          *
  245.          * @return integer
  246.          */
  247.         public function getPrice01Max()
  248.         {
  249.             $this->_calc();
  250.             if (count($this->price01) == 0) {
  251.                 return null;
  252.             }
  253.             return max($this->price01);
  254.         }
  255.         /**
  256.          * Get Price02 min
  257.          *
  258.          * @return integer
  259.          */
  260.         public function getPrice02Min()
  261.         {
  262.             $this->_calc();
  263.             return count($this->price02)
  264.                 ? min($this->price02)
  265.                 : null;
  266.         }
  267.         /**
  268.          * Get Price02 max
  269.          *
  270.          * @return integer
  271.          */
  272.         public function getPrice02Max()
  273.         {
  274.             $this->_calc();
  275.             return count($this->price02)
  276.                 ? max($this->price02)
  277.                 : null;
  278.         }
  279.         /**
  280.          * Get CompanyPrice min
  281.          *
  282.          * @return integer
  283.          */
  284.         public function getCompanyPriceMin()
  285.         {
  286.             $this->_calc();
  287.             return count($this->companyPrice)
  288.                 ? min($this->companyPrice)
  289.                 : null;
  290.         }
  291.         /**
  292.          * Get CompanyPrice max
  293.          *
  294.          * @return integer
  295.          */
  296.         public function getCompanyPriceMax()
  297.         {
  298.             $this->_calc();
  299.             return count($this->companyPrice)
  300.                 ? max($this->companyPrice)
  301.                 : null;
  302.         }
  303.         /**
  304.          * Get Price01IncTax min
  305.          *
  306.          * @return integer
  307.          */
  308.         public function getPrice01IncTaxMin()
  309.         {
  310.             $this->_calc();
  311.             return count($this->price01IncTaxs)
  312.                 ? min($this->price01IncTaxs)
  313.                 : null;
  314.         }
  315.         /**
  316.          * Get Price01IncTax max
  317.          *
  318.          * @return integer
  319.          */
  320.         public function getPrice01IncTaxMax()
  321.         {
  322.             $this->_calc();
  323.             return count($this->price01IncTaxs)
  324.                 ? max($this->price01IncTaxs)
  325.                 : null;
  326.         }
  327.         /**
  328.          * Get Price02IncTax min
  329.          *
  330.          * @return integer
  331.          */
  332.         public function getPrice02IncTaxMin()
  333.         {
  334.             $this->_calc();
  335.             return count($this->price02IncTaxs)
  336.                 ? min($this->price02IncTaxs)
  337.                 : null;
  338.         }
  339.         /**
  340.          * Get Price02IncTax max
  341.          *
  342.          * @return integer
  343.          */
  344.         public function getPrice02IncTaxMax()
  345.         {
  346.             $this->_calc();
  347.             return count($this->price02IncTaxs)
  348.                 ? max($this->price02IncTaxs)
  349.                 : null;
  350.         }
  351.         /**
  352.          * Get Product_code min
  353.          *
  354.          * @return integer
  355.          */
  356.         public function getCodeMin()
  357.         {
  358.             $this->_calc();
  359.             $codes = [];
  360.             foreach ($this->codes as $code) {
  361.                 if (!is_null($code)) {
  362.                     $codes[] = $code;
  363.                 }
  364.             }
  365.             return count($codes) ? min($codes) : null;
  366.         }
  367.         /**
  368.          * Get Product_code max
  369.          *
  370.          * @return integer
  371.          */
  372.         public function getCodeMax()
  373.         {
  374.             $this->_calc();
  375.             $codes = [];
  376.             foreach ($this->codes as $code) {
  377.                 if (!is_null($code)) {
  378.                     $codes[] = $code;
  379.                 }
  380.             }
  381.             return count($codes) ? max($codes) : null;
  382.         }
  383.         public function getMainListImage()
  384.         {
  385.             $ProductImages $this->getProductImage();
  386.             return $ProductImages->isEmpty() ? null $ProductImages[0];
  387.         }
  388.         public function getMainFileName()
  389.         {
  390.             if (count($this->ProductImage) > 0) {
  391.                 return $this->ProductImage[0];
  392.             } else {
  393.                 return null;
  394.             }
  395.         }
  396.         public function hasProductClass()
  397.         {
  398.             foreach ($this->ProductClasses as $ProductClass) {
  399.                 if (!$ProductClass->isVisible()) {
  400.                     continue;
  401.                 }
  402.                 if (!is_null($ProductClass->getClassCategory1())) {
  403.                     return true;
  404.                 }
  405.             }
  406.             return false;
  407.         }
  408.         /**
  409.          * @var integer
  410.          *
  411.          * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  412.          * @ORM\Id
  413.          * @ORM\GeneratedValue(strategy="IDENTITY")
  414.          */
  415.         private $id;
  416.         /**
  417.          * @var string
  418.          *
  419.          * @ORM\Column(name="name", type="string", length=255)
  420.          */
  421.         private $name;
  422.         /**
  423.          * @var string|null
  424.          *
  425.          * @ORM\Column(name="note", type="text", nullable=true)
  426.          */
  427.         private $note;
  428.         /**
  429.          * @var string|null
  430.          *
  431.          * @ORM\Column(name="description_list", type="text", nullable=true)
  432.          */
  433.         private $description_list;
  434.         /**
  435.          * @var string|null
  436.          *
  437.          * @ORM\Column(name="description_detail", type="text", nullable=true)
  438.          */
  439.         private $description_detail;
  440.         /**
  441.          * @var string|null
  442.          *
  443.          * @ORM\Column(name="search_word", type="text", nullable=true)
  444.          */
  445.         private $search_word;
  446.         /**
  447.          * @var string|null
  448.          *
  449.          * @ORM\Column(name="free_area", type="text", nullable=true)
  450.          */
  451.         private $free_area;
  452.         /**
  453.          * @var \DateTime
  454.          *
  455.          * @ORM\Column(name="create_date", type="datetimetz")
  456.          */
  457.         private $create_date;
  458.         /**
  459.          * @var \DateTime
  460.          *
  461.          * @ORM\Column(name="update_date", type="datetimetz")
  462.          */
  463.         private $update_date;
  464.         /**
  465.          * @var \Doctrine\Common\Collections\Collection
  466.          *
  467.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductCategory", mappedBy="Product", cascade={"persist","remove"})
  468.          */
  469.         private $ProductCategories;
  470.         /**
  471.          * @var \Doctrine\Common\Collections\Collection
  472.          *
  473.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductClass", mappedBy="Product", cascade={"persist","remove"})
  474.          */
  475.         private $ProductClasses;
  476.         /**
  477.          * @var \Doctrine\Common\Collections\Collection
  478.          *
  479.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductImage", mappedBy="Product", cascade={"remove"})
  480.          * @ORM\OrderBy({
  481.          *     "sort_no"="ASC"
  482.          * })
  483.          */
  484.         private $ProductImage;
  485.         /**
  486.          * @var \Doctrine\Common\Collections\Collection
  487.          *
  488.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductTag", mappedBy="Product", cascade={"remove"})
  489.          */
  490.         private $ProductTag;
  491.         /**
  492.          * @var \Doctrine\Common\Collections\Collection
  493.          *
  494.          * @ORM\OneToMany(targetEntity="Eccube\Entity\CustomerFavoriteProduct", mappedBy="Product")
  495.          */
  496.         private $CustomerFavoriteProducts;
  497.         /**
  498.          * @var \Eccube\Entity\Member
  499.          *
  500.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
  501.          * @ORM\JoinColumns({
  502.          *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
  503.          * })
  504.          */
  505.         private $Creator;
  506.         /**
  507.          * @var \Eccube\Entity\Master\ProductStatus
  508.          *
  509.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\ProductStatus")
  510.          * @ORM\JoinColumns({
  511.          *   @ORM\JoinColumn(name="product_status_id", referencedColumnName="id")
  512.          * })
  513.          */
  514.         private $Status;
  515.         /**
  516.          * @var boolean
  517.          *
  518.          * @ORM\Column(name="new_arrival", type="boolean", options={"default":false})
  519.          */
  520.         private $new_arrival;
  521.         /**
  522.          * @ORM\Column(name="company_flg", type="boolean", options={"default":false})
  523.          *
  524.          * @var int
  525.          */
  526.         protected $company_flg;
  527.         /**
  528.          * Constructor
  529.          */
  530.         public function __construct()
  531.         {
  532.             $this->ProductCategories = new \Doctrine\Common\Collections\ArrayCollection();
  533.             $this->ProductClasses = new \Doctrine\Common\Collections\ArrayCollection();
  534.             $this->ProductImage = new \Doctrine\Common\Collections\ArrayCollection();
  535.             $this->ProductTag = new \Doctrine\Common\Collections\ArrayCollection();
  536.             $this->CustomerFavoriteProducts = new \Doctrine\Common\Collections\ArrayCollection();
  537.         }
  538.         public function __clone()
  539.         {
  540.             $this->id null;
  541.         }
  542.         public function copy()
  543.         {
  544.             // コピー対象外
  545.             $this->CustomerFavoriteProducts = new ArrayCollection();
  546.             $Categories $this->getProductCategories();
  547.             $this->ProductCategories = new ArrayCollection();
  548.             foreach ($Categories as $Category) {
  549.                 $CopyCategory = clone $Category;
  550.                 $this->addProductCategory($CopyCategory);
  551.                 $CopyCategory->setProduct($this);
  552.             }
  553.             $Classes $this->getProductClasses();
  554.             $this->ProductClasses = new ArrayCollection();
  555.             foreach ($Classes as $Class) {
  556.                 $CopyClass = clone $Class;
  557.                 $this->addProductClass($CopyClass);
  558.                 $CopyClass->setProduct($this);
  559.             }
  560.             $Images $this->getProductImage();
  561.             $this->ProductImage = new ArrayCollection();
  562.             foreach ($Images as $Image) {
  563.                 $CloneImage = clone $Image;
  564.                 $this->addProductImage($CloneImage);
  565.                 $CloneImage->setProduct($this);
  566.             }
  567.             $Tags $this->getProductTag();
  568.             $this->ProductTag = new ArrayCollection();
  569.             foreach ($Tags as $Tag) {
  570.                 $CloneTag = clone $Tag;
  571.                 $this->addProductTag($CloneTag);
  572.                 $CloneTag->setProduct($this);
  573.             }
  574.             return $this;
  575.         }
  576.         /**
  577.          * Get id.
  578.          *
  579.          * @return int
  580.          */
  581.         public function getId()
  582.         {
  583.             return $this->id;
  584.         }
  585.         /**
  586.          * Set name.
  587.          *
  588.          * @param string $name
  589.          *
  590.          * @return Product
  591.          */
  592.         public function setName($name)
  593.         {
  594.             $this->name $name;
  595.             return $this;
  596.         }
  597.         /**
  598.          * Get name.
  599.          *
  600.          * @return string
  601.          */
  602.         public function getName()
  603.         {
  604.             return $this->name;
  605.         }
  606.         /**
  607.          * Set note.
  608.          *
  609.          * @param string|null $note
  610.          *
  611.          * @return Product
  612.          */
  613.         public function setNote($note null)
  614.         {
  615.             $this->note $note;
  616.             return $this;
  617.         }
  618.         /**
  619.          * Get note.
  620.          *
  621.          * @return string|null
  622.          */
  623.         public function getNote()
  624.         {
  625.             return $this->note;
  626.         }
  627.         /**
  628.          * Set descriptionList.
  629.          *
  630.          * @param string|null $descriptionList
  631.          *
  632.          * @return Product
  633.          */
  634.         public function setDescriptionList($descriptionList null)
  635.         {
  636.             $this->description_list $descriptionList;
  637.             return $this;
  638.         }
  639.         /**
  640.          * Get descriptionList.
  641.          *
  642.          * @return string|null
  643.          */
  644.         public function getDescriptionList()
  645.         {
  646.             return $this->description_list;
  647.         }
  648.         /**
  649.          * Set descriptionDetail.
  650.          *
  651.          * @param string|null $descriptionDetail
  652.          *
  653.          * @return Product
  654.          */
  655.         public function setDescriptionDetail($descriptionDetail null)
  656.         {
  657.             $this->description_detail $descriptionDetail;
  658.             return $this;
  659.         }
  660.         /**
  661.          * Get descriptionDetail.
  662.          *
  663.          * @return string|null
  664.          */
  665.         public function getDescriptionDetail()
  666.         {
  667.             return $this->description_detail;
  668.         }
  669.         /**
  670.          * Set searchWord.
  671.          *
  672.          * @param string|null $searchWord
  673.          *
  674.          * @return Product
  675.          */
  676.         public function setSearchWord($searchWord null)
  677.         {
  678.             $this->search_word $searchWord;
  679.             return $this;
  680.         }
  681.         /**
  682.          * Get searchWord.
  683.          *
  684.          * @return string|null
  685.          */
  686.         public function getSearchWord()
  687.         {
  688.             return $this->search_word;
  689.         }
  690.         /**
  691.          * Set newArrival.
  692.          *
  693.          * @param boolean $newArrival
  694.          *
  695.          * @return Product
  696.          */
  697.         public function setNewArrival($newArrival null)
  698.         {
  699.             $this->new_arrival $newArrival;
  700.             return $this;
  701.         }
  702.         /**
  703.          * Get newArrival.
  704.          *
  705.          * @return boolean
  706.          */
  707.         public function getNewArrival()
  708.         {
  709.             return $this->new_arrival;
  710.         }
  711.         /**
  712.          * Set freeArea.
  713.          *
  714.          * @param string|null $freeArea
  715.          *
  716.          * @return Product
  717.          */
  718.         public function setFreeArea($freeArea null)
  719.         {
  720.             $this->free_area $freeArea;
  721.             return $this;
  722.         }
  723.         /**
  724.          * Get freeArea.
  725.          *
  726.          * @return string|null
  727.          */
  728.         public function getFreeArea()
  729.         {
  730.             return $this->free_area;
  731.         }
  732.         /**
  733.          * Set company_flg
  734.          *
  735.          * @param $companyFlg
  736.          *
  737.          * @return $this
  738.          */
  739.         public function setCompanyFlg($companyFlg)
  740.         {
  741.             $this->company_flg $companyFlg;
  742.             return $this;
  743.         }
  744.         /**
  745.          * Get company_flg
  746.          *
  747.          * @return int
  748.          */
  749.         public function getCompanyFlg()
  750.         {
  751.             return $this->company_flg;
  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.     }