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