src/Eccube/Entity/Product.php line 34

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 Customize\Entity\ProductPrecedent;
  14. use Customize\Entity\ProductPrice;
  15. use Customize\Entity\ProductQa;
  16. use Customize\Entity\ProductStaff;
  17. use Doctrine\Common\Collections\ArrayCollection;
  18. use Doctrine\ORM\Mapping as ORM;
  19. use Plugin\ProductReview42\Entity\ProductReview;
  20. if (!class_exists('\Eccube\Entity\Product')) {
  21.     /**
  22.      * Product
  23.      *
  24.      * @ORM\Table(name="dtb_product")
  25.      * @ORM\InheritanceType("SINGLE_TABLE")
  26.      * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  27.      * @ORM\HasLifecycleCallbacks()
  28.      * @ORM\Entity(repositoryClass="Eccube\Repository\ProductRepository")
  29.      */
  30.     class Product extends \Eccube\Entity\AbstractEntity
  31.     {
  32.         private $_calc false;
  33.         private $stockFinds = [];
  34.         private $stocks = [];
  35.         private $stockUnlimiteds = [];
  36.         private $price01 = [];
  37.         private $price02 = [];
  38.         private $price01IncTaxs = [];
  39.         private $price02IncTaxs = [];
  40.         private $codes = [];
  41.         private $classCategories1 = [];
  42.         private $classCategories2 = [];
  43.         private $className1;
  44.         private $className2;
  45.         /**
  46.          * @return string
  47.          */
  48.         public function __toString()
  49.         {
  50.             return (string)$this->getName();
  51.         }
  52.         public function _calc()
  53.         {
  54.             if (!$this->_calc) {
  55.                 $i 0;
  56.                 foreach ($this->getProductClasses() as $ProductClass) {
  57.                     /* @var $ProductClass \Eccube\Entity\ProductClass */
  58.                     // stock_find
  59.                     if ($ProductClass->isVisible() == false) {
  60.                         continue;
  61.                     }
  62.                     $ClassCategory1 $ProductClass->getClassCategory1();
  63.                     $ClassCategory2 $ProductClass->getClassCategory2();
  64.                     if ($ClassCategory1 && !$ClassCategory1->isVisible()) {
  65.                         continue;
  66.                     }
  67.                     if ($ClassCategory2 && !$ClassCategory2->isVisible()) {
  68.                         continue;
  69.                     }
  70.                     // stock_find
  71.                     $this->stockFinds[] = $ProductClass->getStockFind();
  72.                     // stock
  73.                     $this->stocks[] = $ProductClass->getStock();
  74.                     // stock_unlimited
  75.                     $this->stockUnlimiteds[] = $ProductClass->isStockUnlimited();
  76.                     // price01
  77.                     if (!is_null($ProductClass->getPrice01())) {
  78.                         $this->price01[] = $ProductClass->getPrice01();
  79.                         // price01IncTax
  80.                         $this->price01IncTaxs[] = $ProductClass->getPrice01IncTax();
  81.                     }
  82.                     // price02
  83.                     $this->price02[] = $ProductClass->getPrice02();
  84.                     // price02IncTax
  85.                     $this->price02IncTaxs[] = $ProductClass->getPrice02IncTax();
  86.                     // product_code
  87.                     $this->codes[] = $ProductClass->getCode();
  88.                     if ($i === 0) {
  89.                         if ($ProductClass->getClassCategory1() && $ProductClass->getClassCategory1()->getId()) {
  90.                             $this->className1 $ProductClass->getClassCategory1()->getClassName()->getName();
  91.                         }
  92.                         if ($ProductClass->getClassCategory2() && $ProductClass->getClassCategory2()->getId()) {
  93.                             $this->className2 $ProductClass->getClassCategory2()->getClassName()->getName();
  94.                         }
  95.                     }
  96.                     if ($ProductClass->getClassCategory1()) {
  97.                         $classCategoryId1 $ProductClass->getClassCategory1()->getId();
  98.                         if (!empty($classCategoryId1)) {
  99.                             if ($ProductClass->getClassCategory2()) {
  100.                                 $this->classCategories1[$ProductClass->getClassCategory1()->getId()] = $ProductClass->getClassCategory1()->getName();
  101.                                 $this->classCategories2[$ProductClass->getClassCategory1()->getId()][$ProductClass->getClassCategory2()->getId()] = $ProductClass->getClassCategory2()->getName();
  102.                             } else {
  103.                                 $this->classCategories1[$ProductClass->getClassCategory1()->getId()] = $ProductClass->getClassCategory1()->getName() . ($ProductClass->getStockFind() ? '' trans('front.product.out_of_stock_label'));
  104.                             }
  105.                         }
  106.                     }
  107.                     $i++;
  108.                 }
  109.                 $this->_calc true;
  110.             }
  111.         }
  112.         /**
  113.          * Is Enable
  114.          *
  115.          * @return bool
  116.          *
  117.          * @deprecated
  118.          */
  119.         public function isEnable()
  120.         {
  121.             return $this->getStatus()->getId() === \Eccube\Entity\Master\ProductStatus::DISPLAY_SHOW true false;
  122.         }
  123.         /**
  124.          * Get ClassName1
  125.          *
  126.          * @return string
  127.          */
  128.         public function getClassName1()
  129.         {
  130.             $this->_calc();
  131.             return $this->className1;
  132.         }
  133.         /**
  134.          * Get ClassName2
  135.          *
  136.          * @return string
  137.          */
  138.         public function getClassName2()
  139.         {
  140.             $this->_calc();
  141.             return $this->className2;
  142.         }
  143.         /**
  144.          * Get getClassCategories1
  145.          *
  146.          * @return array
  147.          */
  148.         public function getClassCategories1()
  149.         {
  150.             $this->_calc();
  151.             return $this->classCategories1;
  152.         }
  153.         public function getClassCategories1AsFlip()
  154.         {
  155.             return array_flip($this->getClassCategories1());
  156.         }
  157.         /**
  158.          * Get getClassCategories2
  159.          *
  160.          * @return array
  161.          */
  162.         public function getClassCategories2($class_category1)
  163.         {
  164.             $this->_calc();
  165.             return isset($this->classCategories2[$class_category1]) ? $this->classCategories2[$class_category1] : [];
  166.         }
  167.         public function getClassCategories2AsFlip($class_category1)
  168.         {
  169.             return array_flip($this->getClassCategories2($class_category1));
  170.         }
  171.         /**
  172.          * Get StockFind
  173.          *
  174.          * @return bool
  175.          */
  176.         public function getStockFind()
  177.         {
  178.             $this->_calc();
  179.             return count($this->stockFinds)
  180.                 ? max($this->stockFinds)
  181.                 : null;
  182.         }
  183.         /**
  184.          * Get Stock min
  185.          *
  186.          * @return integer
  187.          */
  188.         public function getStockMin()
  189.         {
  190.             $this->_calc();
  191.             return count($this->stocks)
  192.                 ? min($this->stocks)
  193.                 : null;
  194.         }
  195.         /**
  196.          * Get Stock max
  197.          *
  198.          * @return integer
  199.          */
  200.         public function getStockMax()
  201.         {
  202.             $this->_calc();
  203.             return count($this->stocks)
  204.                 ? max($this->stocks)
  205.                 : null;
  206.         }
  207.         /**
  208.          * Get StockUnlimited min
  209.          *
  210.          * @return integer
  211.          */
  212.         public function getStockUnlimitedMin()
  213.         {
  214.             $this->_calc();
  215.             return count($this->stockUnlimiteds)
  216.                 ? min($this->stockUnlimiteds)
  217.                 : null;
  218.         }
  219.         /**
  220.          * Get StockUnlimited max
  221.          *
  222.          * @return integer
  223.          */
  224.         public function getStockUnlimitedMax()
  225.         {
  226.             $this->_calc();
  227.             return count($this->stockUnlimiteds)
  228.                 ? max($this->stockUnlimiteds)
  229.                 : null;
  230.         }
  231.         /**
  232.          * Get Price01 min
  233.          *
  234.          * @return integer
  235.          */
  236.         public function getPrice01Min()
  237.         {
  238.             $this->_calc();
  239.             if (count($this->price01) == 0) {
  240.                 return null;
  241.             }
  242.             return min($this->price01);
  243.         }
  244.         /**
  245.          * Get Price01 max
  246.          *
  247.          * @return integer
  248.          */
  249.         public function getPrice01Max()
  250.         {
  251.             $this->_calc();
  252.             if (count($this->price01) == 0) {
  253.                 return null;
  254.             }
  255.             return max($this->price01);
  256.         }
  257.         /**
  258.          * Get Price02 min
  259.          *
  260.          * @return integer
  261.          */
  262.         public function getPrice02Min()
  263.         {
  264.             $this->_calc();
  265.             return count($this->price02)
  266.                 ? min($this->price02)
  267.                 : null;
  268.         }
  269.         /**
  270.          * Get Price02 max
  271.          *
  272.          * @return integer
  273.          */
  274.         public function getPrice02Max()
  275.         {
  276.             $this->_calc();
  277.             return count($this->price02)
  278.                 ? max($this->price02)
  279.                 : null;
  280.         }
  281.         /**
  282.          * Get Price01IncTax min
  283.          *
  284.          * @return integer
  285.          */
  286.         public function getPrice01IncTaxMin()
  287.         {
  288.             $this->_calc();
  289.             return count($this->price01IncTaxs)
  290.                 ? min($this->price01IncTaxs)
  291.                 : null;
  292.         }
  293.         /**
  294.          * Get Price01IncTax max
  295.          *
  296.          * @return integer
  297.          */
  298.         public function getPrice01IncTaxMax()
  299.         {
  300.             $this->_calc();
  301.             return count($this->price01IncTaxs)
  302.                 ? max($this->price01IncTaxs)
  303.                 : null;
  304.         }
  305.         /**
  306.          * Get Price02IncTax min
  307.          *
  308.          * @return integer
  309.          */
  310.         public function getPrice02IncTaxMin()
  311.         {
  312.             $this->_calc();
  313.             return count($this->price02IncTaxs)
  314.                 ? min($this->price02IncTaxs)
  315.                 : null;
  316.         }
  317.         /**
  318.          * Get Price02IncTax max
  319.          *
  320.          * @return integer
  321.          */
  322.         public function getPrice02IncTaxMax()
  323.         {
  324.             $this->_calc();
  325.             return count($this->price02IncTaxs)
  326.                 ? max($this->price02IncTaxs)
  327.                 : null;
  328.         }
  329.         /**
  330.          * Get Product_code min
  331.          *
  332.          * @return integer
  333.          */
  334.         public function getCodeMin()
  335.         {
  336.             $this->_calc();
  337.             $codes = [];
  338.             foreach ($this->codes as $code) {
  339.                 if (!is_null($code)) {
  340.                     $codes[] = $code;
  341.                 }
  342.             }
  343.             return count($codes) ? min($codes) : null;
  344.         }
  345.         /**
  346.          * Get Product_code max
  347.          *
  348.          * @return integer
  349.          */
  350.         public function getCodeMax()
  351.         {
  352.             $this->_calc();
  353.             $codes = [];
  354.             foreach ($this->codes as $code) {
  355.                 if (!is_null($code)) {
  356.                     $codes[] = $code;
  357.                 }
  358.             }
  359.             return count($codes) ? max($codes) : null;
  360.         }
  361.         public function getMainListImage()
  362.         {
  363.             $ProductImages $this->getProductImage();
  364.             return $ProductImages->isEmpty() ? null $ProductImages[0];
  365.         }
  366.         public function getMainFileName()
  367.         {
  368.             if (count($this->ProductImage) > 0) {
  369.                 return $this->ProductImage[0];
  370.             } else {
  371.                 return null;
  372.             }
  373.         }
  374.         public function hasProductClass()
  375.         {
  376.             foreach ($this->ProductClasses as $ProductClass) {
  377.                 if (!$ProductClass->isVisible()) {
  378.                     continue;
  379.                 }
  380.                 if (!is_null($ProductClass->getClassCategory1())) {
  381.                     return true;
  382.                 }
  383.             }
  384.             return false;
  385.         }
  386.         /**
  387.          * @var integer
  388.          *
  389.          * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  390.          * @ORM\Id
  391.          * @ORM\GeneratedValue(strategy="IDENTITY")
  392.          */
  393.         private $id;
  394.         /**
  395.          * @var string
  396.          *
  397.          * @ORM\Column(name="name", type="string", length=255)
  398.          */
  399.         private $name;
  400.         /**
  401.          * @var string|null
  402.          *
  403.          * @ORM\Column(name="note", type="text", nullable=true)
  404.          */
  405.         private $note;
  406.         /**
  407.          * @var string|null
  408.          *
  409.          * @ORM\Column(name="description_list", type="text", nullable=true)
  410.          */
  411.         private $description_list;
  412.         /**
  413.          * @var string|null
  414.          *
  415.          * @ORM\Column(name="description_detail", type="text", nullable=true)
  416.          */
  417.         private $description_detail;
  418.         /**
  419.          * @var string|null
  420.          *
  421.          * @ORM\Column(name="search_word", type="text", nullable=true)
  422.          */
  423.         private $search_word;
  424.         /**
  425.          * @var string|null
  426.          *
  427.          * @ORM\Column(name="free_area", type="text", nullable=true)
  428.          */
  429.         private $free_area;
  430.         /**
  431.          * @var \DateTime
  432.          *
  433.          * @ORM\Column(name="create_date", type="datetimetz")
  434.          */
  435.         private $create_date;
  436.         /**
  437.          * @var \DateTime
  438.          *
  439.          * @ORM\Column(name="update_date", type="datetimetz")
  440.          */
  441.         private $update_date;
  442.         /**
  443.          * @var \Doctrine\Common\Collections\Collection
  444.          *
  445.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductCategory", mappedBy="Product", cascade={"persist","remove"})
  446.          */
  447.         private $ProductCategories;
  448.         /**
  449.          * @var \Doctrine\Common\Collections\Collection
  450.          *
  451.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductClass", mappedBy="Product", cascade={"persist","remove"})
  452.          */
  453.         private $ProductClasses;
  454.         /**
  455.          * @var \Doctrine\Common\Collections\Collection
  456.          *
  457.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductImage", mappedBy="Product", cascade={"remove"})
  458.          * @ORM\OrderBy({
  459.          *     "sort_no"="ASC"
  460.          * })
  461.          */
  462.         private $ProductImage;
  463.         /**
  464.          * @var \Doctrine\Common\Collections\Collection
  465.          *
  466.          * @ORM\OneToMany(targetEntity="Customize\Entity\ProductPrecedent", mappedBy="Product", cascade={"remove"})
  467.          */
  468.         private $ProductPrecedent;
  469.         /**
  470.          * @var \Doctrine\Common\Collections\Collection
  471.          *
  472.          * @ORM\OneToMany(targetEntity="Plugin\ProductReview42\Entity\ProductReview", mappedBy="Product", cascade={"remove"})
  473.          */
  474.         private $ProductReview;
  475.         /**
  476.          * @var \Doctrine\Common\Collections\Collection
  477.          *
  478.          * @ORM\OneToMany(targetEntity="Customize\Entity\ProductPrice", mappedBy="Product", cascade={"remove"})
  479.          */
  480.         private $ProductPrice;
  481.         /**
  482.          * @var \Doctrine\Common\Collections\Collection
  483.          *
  484.          * @ORM\OneToMany(targetEntity="Customize\Entity\ProductStaff", mappedBy="Product", cascade={"remove"})
  485.          */
  486.         private $ProductStaff;
  487.         /**
  488.          * @var \Doctrine\Common\Collections\Collection
  489.          *
  490.          * @ORM\OneToMany(targetEntity="Customize\Entity\ProductQa", mappedBy="Product", cascade={"remove"})
  491.          */
  492.         private $ProductQa;
  493.         /**
  494.          * @var \Doctrine\Common\Collections\Collection
  495.          *
  496.          * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductTag", mappedBy="Product", cascade={"remove"})
  497.          */
  498.         private $ProductTag;
  499.         /**
  500.          * @var \Doctrine\Common\Collections\Collection
  501.          *
  502.          * @ORM\OneToMany(targetEntity="Eccube\Entity\CustomerFavoriteProduct", mappedBy="Product")
  503.          */
  504.         private $CustomerFavoriteProducts;
  505.         /**
  506.          * @var \Eccube\Entity\Member
  507.          *
  508.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
  509.          * @ORM\JoinColumns({
  510.          *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
  511.          * })
  512.          */
  513.         private $Creator;
  514.         /**
  515.          * @var \Eccube\Entity\Master\ProductStatus
  516.          *
  517.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\ProductStatus")
  518.          * @ORM\JoinColumns({
  519.          *   @ORM\JoinColumn(name="product_status_id", referencedColumnName="id")
  520.          * })
  521.          */
  522.         private $Status;
  523.         /**
  524.          * @var string
  525.          *
  526.          * @ORM\Column(name="comment", type="text", nullable=true)
  527.          */
  528.         private $comment;
  529.         /**
  530.          * @var string
  531.          *
  532.          * @ORM\Column(name="service_overview", type="text", nullable=true)
  533.          */
  534.         private $service_overview;
  535.         /**
  536.          * @var string
  537.          *
  538.          * @ORM\Column(name="service_flow", type="text", nullable=true)
  539.          */
  540.         private $service_flow;
  541.         /**
  542.          * @var string|null
  543.          *
  544.          * @ORM\Column(name="cleaning_service_basic_price", type="string", length=255, nullable=true)
  545.          */
  546.         private $cleaning_service_basic_price;
  547.         /**
  548.          * @var string
  549.          *
  550.          * @ORM\Column(name="other_compatible_services", type="string", length=255, nullable=true)
  551.          */
  552.         private $other_compatible_services;
  553.         /**
  554.          * @var string
  555.          *
  556.          * @ORM\Column(name="payment_method", type="string", length=255, nullable=true)
  557.          */
  558.         private $payment_method;
  559.         /**
  560.          * @var string
  561.          *
  562.          * @ORM\Column(name="cancel_policy", type="text", nullable=true)
  563.          */
  564.         private $cancel_policy;
  565.         /**
  566.          * @var string
  567.          *
  568.          * @ORM\Column(name="video_embed", type="string", length=255, nullable=true)
  569.          */
  570.         private $video_embed;
  571.         /**
  572.          * @var string
  573.          *
  574.          * @ORM\Column(name="location", type="string", length=100, nullable=true)
  575.          */
  576.         private $location;
  577.         /**
  578.          * @var string
  579.          *
  580.          * @ORM\Column(name="representative", type="string", length=100, nullable=true)
  581.          */
  582.         private $representative;
  583.         /**
  584.          * @var string
  585.          *
  586.          * @ORM\Column(name="credentials", type="string", length=255, nullable=true)
  587.          */
  588.         private $credentials;
  589.         /**
  590.          * @var string
  591.          *
  592.          * @ORM\Column(name="count_access", type="integer", length=10, nullable=true)
  593.          */
  594.         private $count_access;
  595.         /**
  596.          * Constructor
  597.          */
  598.         public function __construct()
  599.         {
  600.             $this->ProductCategories = new \Doctrine\Common\Collections\ArrayCollection();
  601.             $this->ProductClasses = new \Doctrine\Common\Collections\ArrayCollection();
  602.             $this->ProductImage = new \Doctrine\Common\Collections\ArrayCollection();
  603.             $this->ProductTag = new \Doctrine\Common\Collections\ArrayCollection();
  604.             $this->CustomerFavoriteProducts = new \Doctrine\Common\Collections\ArrayCollection();
  605.             $this->ProductPrecedent = new \Doctrine\Common\Collections\ArrayCollection();
  606.             $this->ProductReview = new \Doctrine\Common\Collections\ArrayCollection();
  607.         }
  608.         public function __clone()
  609.         {
  610.             $this->id null;
  611.         }
  612.         public function copy()
  613.         {
  614.             // コピー対象外
  615.             $this->CustomerFavoriteProducts = new ArrayCollection();
  616.             $Categories $this->getProductCategories();
  617.             $this->ProductCategories = new ArrayCollection();
  618.             foreach ($Categories as $Category) {
  619.                 $CopyCategory = clone $Category;
  620.                 $this->addProductCategory($CopyCategory);
  621.                 $CopyCategory->setProduct($this);
  622.             }
  623.             $Classes $this->getProductClasses();
  624.             $this->ProductClasses = new ArrayCollection();
  625.             foreach ($Classes as $Class) {
  626.                 $CopyClass = clone $Class;
  627.                 $this->addProductClass($CopyClass);
  628.                 $CopyClass->setProduct($this);
  629.             }
  630.             $Images $this->getProductImage();
  631.             $this->ProductImage = new ArrayCollection();
  632.             foreach ($Images as $Image) {
  633.                 $CloneImage = clone $Image;
  634.                 $this->addProductImage($CloneImage);
  635.                 $CloneImage->setProduct($this);
  636.             }
  637.             $Tags $this->getProductTag();
  638.             $this->ProductTag = new ArrayCollection();
  639.             foreach ($Tags as $Tag) {
  640.                 $CloneTag = clone $Tag;
  641.                 $this->addProductTag($CloneTag);
  642.                 $CloneTag->setProduct($this);
  643.             }
  644.             return $this;
  645.         }
  646.         /**
  647.          * Get id.
  648.          *
  649.          * @return int
  650.          */
  651.         public function getId()
  652.         {
  653.             return $this->id;
  654.         }
  655.         /**
  656.          * Set name.
  657.          *
  658.          * @param string $name
  659.          *
  660.          * @return Product
  661.          */
  662.         public function setName($name)
  663.         {
  664.             $this->name $name;
  665.             return $this;
  666.         }
  667.         /**
  668.          * Get name.
  669.          *
  670.          * @return string
  671.          */
  672.         public function getName()
  673.         {
  674.             return $this->name;
  675.         }
  676.         /**
  677.          * Set note.
  678.          *
  679.          * @param string|null $note
  680.          *
  681.          * @return Product
  682.          */
  683.         public function setNote($note null)
  684.         {
  685.             $this->note $note;
  686.             return $this;
  687.         }
  688.         /**
  689.          * Get note.
  690.          *
  691.          * @return string|null
  692.          */
  693.         public function getNote()
  694.         {
  695.             return $this->note;
  696.         }
  697.         /**
  698.          * Set descriptionList.
  699.          *
  700.          * @param string|null $descriptionList
  701.          *
  702.          * @return Product
  703.          */
  704.         public function setDescriptionList($descriptionList null)
  705.         {
  706.             $this->description_list $descriptionList;
  707.             return $this;
  708.         }
  709.         /**
  710.          * Get descriptionList.
  711.          *
  712.          * @return string|null
  713.          */
  714.         public function getDescriptionList()
  715.         {
  716.             return $this->description_list;
  717.         }
  718.         /**
  719.          * Set descriptionDetail.
  720.          *
  721.          * @param string|null $descriptionDetail
  722.          *
  723.          * @return Product
  724.          */
  725.         public function setDescriptionDetail($descriptionDetail null)
  726.         {
  727.             $this->description_detail $descriptionDetail;
  728.             return $this;
  729.         }
  730.         /**
  731.          * Get descriptionDetail.
  732.          *
  733.          * @return string|null
  734.          */
  735.         public function getDescriptionDetail()
  736.         {
  737.             return $this->description_detail;
  738.         }
  739.         /**
  740.          * Set searchWord.
  741.          *
  742.          * @param string|null $searchWord
  743.          *
  744.          * @return Product
  745.          */
  746.         public function setSearchWord($searchWord null)
  747.         {
  748.             $this->search_word $searchWord;
  749.             return $this;
  750.         }
  751.         /**
  752.          * Get searchWord.
  753.          *
  754.          * @return string|null
  755.          */
  756.         public function getSearchWord()
  757.         {
  758.             return $this->search_word;
  759.         }
  760.         /**
  761.          * Set freeArea.
  762.          *
  763.          * @param string|null $freeArea
  764.          *
  765.          * @return Product
  766.          */
  767.         public function setFreeArea($freeArea null)
  768.         {
  769.             $this->free_area $freeArea;
  770.             return $this;
  771.         }
  772.         /**
  773.          * Get freeArea.
  774.          *
  775.          * @return string|null
  776.          */
  777.         public function getFreeArea()
  778.         {
  779.             return $this->free_area;
  780.         }
  781.         /**
  782.          * Set createDate.
  783.          *
  784.          * @param \DateTime $createDate
  785.          *
  786.          * @return Product
  787.          */
  788.         public function setCreateDate($createDate)
  789.         {
  790.             $this->create_date $createDate;
  791.             return $this;
  792.         }
  793.         /**
  794.          * Get createDate.
  795.          *
  796.          * @return \DateTime
  797.          */
  798.         public function getCreateDate()
  799.         {
  800.             return $this->create_date;
  801.         }
  802.         /**
  803.          * Set updateDate.
  804.          *
  805.          * @param \DateTime $updateDate
  806.          *
  807.          * @return Product
  808.          */
  809.         public function setUpdateDate($updateDate)
  810.         {
  811.             $this->update_date $updateDate;
  812.             return $this;
  813.         }
  814.         /**
  815.          * Get updateDate.
  816.          *
  817.          * @return \DateTime
  818.          */
  819.         public function getUpdateDate()
  820.         {
  821.             return $this->update_date;
  822.         }
  823.         /**
  824.          * Add productCategory.
  825.          *
  826.          * @param \Eccube\Entity\ProductCategory $productCategory
  827.          *
  828.          * @return Product
  829.          */
  830.         public function addProductCategory(ProductCategory $productCategory)
  831.         {
  832.             $this->ProductCategories[] = $productCategory;
  833.             return $this;
  834.         }
  835.         /**
  836.          * Remove productCategory.
  837.          *
  838.          * @param \Eccube\Entity\ProductCategory $productCategory
  839.          *
  840.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  841.          */
  842.         public function removeProductCategory(ProductCategory $productCategory)
  843.         {
  844.             return $this->ProductCategories->removeElement($productCategory);
  845.         }
  846.         /**
  847.          * Get productCategories.
  848.          *
  849.          * @return \Doctrine\Common\Collections\Collection
  850.          */
  851.         public function getProductCategories()
  852.         {
  853.             return $this->ProductCategories;
  854.         }
  855.         /**
  856.          * Add productClass.
  857.          *
  858.          * @param \Eccube\Entity\ProductClass $productClass
  859.          *
  860.          * @return Product
  861.          */
  862.         public function addProductClass(ProductClass $productClass)
  863.         {
  864.             $this->ProductClasses[] = $productClass;
  865.             return $this;
  866.         }
  867.         /**
  868.          * Remove productClass.
  869.          *
  870.          * @param \Eccube\Entity\ProductClass $productClass
  871.          *
  872.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  873.          */
  874.         public function removeProductClass(ProductClass $productClass)
  875.         {
  876.             return $this->ProductClasses->removeElement($productClass);
  877.         }
  878.         /**
  879.          * Get productClasses.
  880.          *
  881.          * @return \Doctrine\Common\Collections\Collection
  882.          */
  883.         public function getProductClasses()
  884.         {
  885.             return $this->ProductClasses;
  886.         }
  887.         /**
  888.          * Add productImage.
  889.          *
  890.          * @param \Eccube\Entity\ProductImage $productImage
  891.          *
  892.          * @return Product
  893.          */
  894.         public function addProductImage(ProductImage $productImage)
  895.         {
  896.             $this->ProductImage[] = $productImage;
  897.             return $this;
  898.         }
  899.         /**
  900.          * Remove productImage.
  901.          *
  902.          * @param \Eccube\Entity\ProductImage $productImage
  903.          *
  904.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  905.          */
  906.         public function removeProductImage(ProductImage $productImage)
  907.         {
  908.             return $this->ProductImage->removeElement($productImage);
  909.         }
  910.         /**
  911.          * Get productImage.
  912.          *
  913.          * @return \Doctrine\Common\Collections\Collection
  914.          */
  915.         public function getProductImage()
  916.         {
  917.             return $this->ProductImage;
  918.         }
  919.         /**
  920.          * Add productPrecedent.
  921.          *
  922.          * @param ProductPrecedent $productPrecedent
  923.          *
  924.          * @return Product
  925.          */
  926.         public function addProductPrecedent(ProductPrecedent $productPrecedent)
  927.         {
  928.             $this->ProductPrecedent[] = $productPrecedent;
  929.             return $this;
  930.         }
  931.         /**
  932.          * Remove productPrecedent.
  933.          *
  934.          * @param ProductPrecedent $productPrecedent
  935.          *
  936.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  937.          */
  938.         public function removeProductPrecedent(ProductPrecedent $productPrecedent)
  939.         {
  940.             return $this->ProductPrecedent->removeElement($productPrecedent);
  941.         }
  942.         /**
  943.          * Get productPrecedent.
  944.          *
  945.          * @return \Doctrine\Common\Collections\Collection
  946.          */
  947.         public function getProductPrecedent()
  948.         {
  949.             return $this->ProductPrecedent;
  950.         }
  951.         /**
  952.          * Add productPrice.
  953.          *
  954.          * @param ProductPrice $productPrice
  955.          *
  956.          * @return Product
  957.          */
  958.         public function addProductPrice(ProductPrice $productPrice)
  959.         {
  960.             $this->ProductPrice[] = $productPrice;
  961.             return $this;
  962.         }
  963.         /**
  964.          * Remove productPrice.
  965.          *
  966.          * @param ProductPrice $productPrice
  967.          *
  968.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  969.          */
  970.         public function removeProductPrice(ProductPrice $productPrice)
  971.         {
  972.             return $this->ProductPrice->removeElement($productPrice);
  973.         }
  974.         /**
  975.          * Get productPrice.
  976.          *
  977.          * @return \Doctrine\Common\Collections\Collection
  978.          */
  979.         public function getProductPrice()
  980.         {
  981.             return $this->ProductPrice;
  982.         }
  983.         /**
  984.          * Add productStaff.
  985.          *
  986.          * @param ProductStaff $productStaff
  987.          *
  988.          * @return Product
  989.          */
  990.         public function addProductStaff(ProductStaff $productStaff)
  991.         {
  992.             $this->ProductStaff[] = $productStaff;
  993.             return $this;
  994.         }
  995.         /**
  996.          * Remove productStaff.
  997.          *
  998.          * @param ProductStaff $productStaff
  999.          *
  1000.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1001.          */
  1002.         public function removeProductStaff(ProductStaff $productStaff)
  1003.         {
  1004.             return $this->ProductStaff->removeElement($productStaff);
  1005.         }
  1006.         /**
  1007.          * Get productStaff.
  1008.          *
  1009.          * @return \Doctrine\Common\Collections\Collection
  1010.          */
  1011.         public function getProductStaff()
  1012.         {
  1013.             return $this->ProductStaff;
  1014.         }
  1015.         /**
  1016.          * Add productQa.
  1017.          *
  1018.          * @param ProductQa $productQa
  1019.          *
  1020.          * @return Product
  1021.          */
  1022.         public function addProductQa(ProductQa $productQa)
  1023.         {
  1024.             $this->ProductQa[] = $productQa;
  1025.             return $this;
  1026.         }
  1027.         /**
  1028.          * Remove productQa.
  1029.          *
  1030.          * @param ProductQa $productQa
  1031.          *
  1032.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1033.          */
  1034.         public function removeProductQa(ProductQa $productQa)
  1035.         {
  1036.             return $this->ProductQa->removeElement($productQa);
  1037.         }
  1038.         /**
  1039.          * Get productQa.
  1040.          *
  1041.          * @return \Doctrine\Common\Collections\Collection
  1042.          */
  1043.         public function getProductQa()
  1044.         {
  1045.             return $this->ProductQa;
  1046.         }
  1047.         /**
  1048.          * Add productTag.
  1049.          *
  1050.          * @param \Eccube\Entity\ProductTag $productTag
  1051.          *
  1052.          * @return Product
  1053.          */
  1054.         public function addProductTag(ProductTag $productTag)
  1055.         {
  1056.             $this->ProductTag[] = $productTag;
  1057.             return $this;
  1058.         }
  1059.         /**
  1060.          * Remove productTag.
  1061.          *
  1062.          * @param \Eccube\Entity\ProductTag $productTag
  1063.          *
  1064.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1065.          */
  1066.         public function removeProductTag(ProductTag $productTag)
  1067.         {
  1068.             return $this->ProductTag->removeElement($productTag);
  1069.         }
  1070.         /**
  1071.          * Get productTag.
  1072.          *
  1073.          * @return \Doctrine\Common\Collections\Collection
  1074.          */
  1075.         public function getProductTag()
  1076.         {
  1077.             return $this->ProductTag;
  1078.         }
  1079.         /**
  1080.          * Get Tag
  1081.          * フロント側タグsort_no順の配列を作成する
  1082.          *
  1083.          * @return []Tag
  1084.          */
  1085.         public function getTags()
  1086.         {
  1087.             $tags = [];
  1088.             foreach ($this->getProductTag() as $productTag) {
  1089.                 $tags[] = $productTag->getTag();
  1090.             }
  1091.             usort($tags, function (Tag $tag1Tag $tag2) {
  1092.                 return $tag1->getSortNo() < $tag2->getSortNo();
  1093.             });
  1094.             return $tags;
  1095.         }
  1096.         /**
  1097.          * Add customerFavoriteProduct.
  1098.          *
  1099.          * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct
  1100.          *
  1101.          * @return Product
  1102.          */
  1103.         public function addCustomerFavoriteProduct(CustomerFavoriteProduct $customerFavoriteProduct)
  1104.         {
  1105.             $this->CustomerFavoriteProducts[] = $customerFavoriteProduct;
  1106.             return $this;
  1107.         }
  1108.         /**
  1109.          * Remove customerFavoriteProduct.
  1110.          *
  1111.          * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct
  1112.          *
  1113.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1114.          */
  1115.         public function removeCustomerFavoriteProduct(CustomerFavoriteProduct $customerFavoriteProduct)
  1116.         {
  1117.             return $this->CustomerFavoriteProducts->removeElement($customerFavoriteProduct);
  1118.         }
  1119.         /**
  1120.          * Get customerFavoriteProducts.
  1121.          *
  1122.          * @return \Doctrine\Common\Collections\Collection
  1123.          */
  1124.         public function getCustomerFavoriteProducts()
  1125.         {
  1126.             return $this->CustomerFavoriteProducts;
  1127.         }
  1128.         /**
  1129.          * Set creator.
  1130.          *
  1131.          * @param \Eccube\Entity\Member|null $creator
  1132.          *
  1133.          * @return Product
  1134.          */
  1135.         public function setCreator(Member $creator null)
  1136.         {
  1137.             $this->Creator $creator;
  1138.             return $this;
  1139.         }
  1140.         /**
  1141.          * Get creator.
  1142.          *
  1143.          * @return \Eccube\Entity\Member|null
  1144.          */
  1145.         public function getCreator()
  1146.         {
  1147.             return $this->Creator;
  1148.         }
  1149.         /**
  1150.          * Set status.
  1151.          *
  1152.          * @param \Eccube\Entity\Master\ProductStatus|null $status
  1153.          *
  1154.          * @return Product
  1155.          */
  1156.         public function setStatus(Master\ProductStatus $status null)
  1157.         {
  1158.             $this->Status $status;
  1159.             return $this;
  1160.         }
  1161.         /**
  1162.          * Get status.
  1163.          *
  1164.          * @return \Eccube\Entity\Master\ProductStatus|null
  1165.          */
  1166.         public function getStatus()
  1167.         {
  1168.             return $this->Status;
  1169.         }
  1170.         /**
  1171.          * Set comment.
  1172.          *
  1173.          * @param string $comment
  1174.          *
  1175.          * @return Product
  1176.          */
  1177.         public function setComment($comment)
  1178.         {
  1179.             $this->comment $comment;
  1180.             return $this;
  1181.         }
  1182.         /**
  1183.          * Get comment.
  1184.          *
  1185.          * @return string
  1186.          */
  1187.         public function getComment()
  1188.         {
  1189.             return $this->comment;
  1190.         }
  1191.         /**
  1192.          * Set service_overview.
  1193.          *
  1194.          * @param string $service_overview
  1195.          *
  1196.          * @return Product
  1197.          */
  1198.         public function setServiceOverview($service_overview)
  1199.         {
  1200.             $this->service_overview $service_overview;
  1201.             return $this;
  1202.         }
  1203.         /**
  1204.          * Get service_overview.
  1205.          *
  1206.          * @return string
  1207.          */
  1208.         public function getServiceOverview()
  1209.         {
  1210.             return $this->service_overview;
  1211.         }
  1212.         /**
  1213.          * Set service_flow.
  1214.          *
  1215.          * @param string $service_flow
  1216.          *
  1217.          * @return Product
  1218.          */
  1219.         public function setServiceFlow($service_flow)
  1220.         {
  1221.             $this->service_flow $service_flow;
  1222.             return $this;
  1223.         }
  1224.         /**
  1225.          * Get service_flow.
  1226.          *
  1227.          * @return string
  1228.          */
  1229.         public function getServiceFlow()
  1230.         {
  1231.             return $this->service_flow;
  1232.         }
  1233.         /**
  1234.          * Set cleaning_service_basic_price.
  1235.          *
  1236.          * @param string $cleaning_service_basic_price
  1237.          *
  1238.          * @return Product
  1239.          */
  1240.         public function setCleaningServiceBasicPrice($cleaning_service_basic_price)
  1241.         {
  1242.             $this->cleaning_service_basic_price $cleaning_service_basic_price;
  1243.             return $this;
  1244.         }
  1245.         /**
  1246.          * Get cleaning_service_basic_price.
  1247.          *
  1248.          * @return string
  1249.          */
  1250.         public function getCleaningServiceBasicPrice()
  1251.         {
  1252.             return $this->cleaning_service_basic_price;
  1253.         }
  1254.         /**
  1255.          * Set other_compatible_services.
  1256.          *
  1257.          * @param string $other_compatible_services
  1258.          *
  1259.          * @return Product
  1260.          */
  1261.         public function setOtherCompatibleServices($other_compatible_services)
  1262.         {
  1263.             $this->other_compatible_services $other_compatible_services;
  1264.             return $this;
  1265.         }
  1266.         /**
  1267.          * Get other_compatible_services.
  1268.          *
  1269.          * @return string
  1270.          */
  1271.         public function getOtherCompatibleServices()
  1272.         {
  1273.             return $this->other_compatible_services;
  1274.         }
  1275.         /**
  1276.          * Set payment_method.
  1277.          *
  1278.          * @param string $payment_method
  1279.          *
  1280.          * @return Product
  1281.          */
  1282.         public function setPaymentMethod($payment_method)
  1283.         {
  1284.             $this->payment_method $payment_method;
  1285.             return $this;
  1286.         }
  1287.         /**
  1288.          * Get payment_method.
  1289.          *
  1290.          * @return string
  1291.          */
  1292.         public function getPaymentMethod()
  1293.         {
  1294.             return $this->payment_method;
  1295.         }
  1296.         /**
  1297.          * Set cancel_policy.
  1298.          *
  1299.          * @param string $cancel_policy
  1300.          *
  1301.          * @return Product
  1302.          */
  1303.         public function setCancelPolicy($cancel_policy)
  1304.         {
  1305.             $this->cancel_policy $cancel_policy;
  1306.             return $this;
  1307.         }
  1308.         /**
  1309.          * Get cancel_policy.
  1310.          *
  1311.          * @return string
  1312.          */
  1313.         public function getCancelPolicy()
  1314.         {
  1315.             return $this->cancel_policy;
  1316.         }
  1317.         /**
  1318.          * Set video_embed.
  1319.          *
  1320.          * @param string $video_embed
  1321.          *
  1322.          * @return Product
  1323.          */
  1324.         public function setVideoEmbed($video_embed)
  1325.         {
  1326.             $this->video_embed $video_embed;
  1327.             return $this;
  1328.         }
  1329.         /**
  1330.          * Get video_embed.
  1331.          *
  1332.          * @return string
  1333.          */
  1334.         public function getVideoEmbed()
  1335.         {
  1336.             return $this->video_embed;
  1337.         }
  1338.         /**
  1339.          * Set location.
  1340.          *
  1341.          * @param string $location
  1342.          *
  1343.          * @return Product
  1344.          */
  1345.         public function setLocation($location)
  1346.         {
  1347.             $this->location $location;
  1348.             return $this;
  1349.         }
  1350.         /**
  1351.          * Get location.
  1352.          *
  1353.          * @return string
  1354.          */
  1355.         public function getLocation()
  1356.         {
  1357.             return $this->location;
  1358.         }
  1359.         /**
  1360.          * Set representative.
  1361.          *
  1362.          * @param string $representative
  1363.          *
  1364.          * @return Product
  1365.          */
  1366.         public function setRepresentative($representative)
  1367.         {
  1368.             $this->representative $representative;
  1369.             return $this;
  1370.         }
  1371.         /**
  1372.          * Get representative.
  1373.          *
  1374.          * @return string
  1375.          */
  1376.         public function getRepresentative()
  1377.         {
  1378.             return $this->representative;
  1379.         }
  1380.         /**
  1381.          * Set credentials.
  1382.          *
  1383.          * @param string $credentials
  1384.          *
  1385.          * @return Product
  1386.          */
  1387.         public function setCredentials($credentials)
  1388.         {
  1389.             $this->credentials $credentials;
  1390.             return $this;
  1391.         }
  1392.         /**
  1393.          * Get credentials.
  1394.          *
  1395.          * @return string
  1396.          */
  1397.         public function getCredentials()
  1398.         {
  1399.             return $this->credentials;
  1400.         }
  1401.         /**
  1402.          * Add productReview.
  1403.          *
  1404.          * @param ProductReview $productReview
  1405.          *
  1406.          * @return Product
  1407.          */
  1408.         public function addProductReview(ProductReview $productReview)
  1409.         {
  1410.             $this->ProductReview[] = $productReview;
  1411.             return $this;
  1412.         }
  1413.         /**
  1414.          * Remove productReview.
  1415.          *
  1416.          * @param ProductReview $productReview
  1417.          *
  1418.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1419.          */
  1420.         public function removeProductReview(ProductReview $productReview)
  1421.         {
  1422.             return $this->ProductReview->removeElement($productReview);
  1423.         }
  1424.         /**
  1425.          * Get productReview.
  1426.          *
  1427.          * @return \Doctrine\Common\Collections\Collection
  1428.          */
  1429.         public function getProductReview()
  1430.         {
  1431.             return $this->ProductReview;
  1432.         }
  1433.         /**
  1434.          * Get productReviewStar.
  1435.          *
  1436.          * @return \Doctrine\Common\Collections\Collection|float|int
  1437.          */
  1438.         public function getProductReviewStar()
  1439.         {
  1440.             if ($this->ProductReview->count() > 0) {
  1441.                 $productReviewTotal 0;
  1442.                 foreach ($this->ProductReview as $review) {
  1443.                     $productReviewTotal += $review->getStar();
  1444.                 }
  1445.                 return $productReviewTotal $this->ProductReview->count();
  1446.             }
  1447.             return 0;
  1448.         }
  1449.         /**
  1450.          * Get productReviewCount.
  1451.          *
  1452.          * @return \Doctrine\Common\Collections\Collection|float|int
  1453.          */
  1454.         public function getProductReviewCount()
  1455.         {
  1456.             return $this->ProductReview->count();
  1457.         }
  1458.         /**
  1459.          * Set count_access.
  1460.          *
  1461.          * @param string $count_access
  1462.          *
  1463.          * @return Product
  1464.          */
  1465.         public function setCountAccess($count_access)
  1466.         {
  1467.             $this->count_access $count_access;
  1468.             return $this;
  1469.         }
  1470.         /**
  1471.          * Get count_access.
  1472.          *
  1473.          * @return string
  1474.          */
  1475.         public function getCountAccess()
  1476.         {
  1477.             return $this->count_access;
  1478.         }
  1479.         /**
  1480.          * Set updateAccess.
  1481.          *
  1482.          * @return Product
  1483.          */
  1484.         public function setUpdateAccess()
  1485.         {
  1486.             $this->count_access += 1;
  1487.             return $this;
  1488.         }
  1489.     }
  1490. }