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

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