app/proxy/entity/src/Eccube/Entity/ProductClass.php line 28

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\ORM\Mapping as ORM;
  14. /**
  15. * ProductClass
  16. *
  17. * @ORM\Table(name="dtb_product_class", indexes={@ORM\Index(name="dtb_product_class_price02_idx", columns={"price02"}), @ORM\Index(name="dtb_product_class_stock_stock_unlimited_idx", columns={"stock", "stock_unlimited"})})
  18. * @ORM\InheritanceType("SINGLE_TABLE")
  19. * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  20. * @ORM\HasLifecycleCallbacks()
  21. * @ORM\Entity(repositoryClass="Eccube\Repository\ProductClassRepository")
  22. */
  23. class ProductClass extends \Eccube\Entity\AbstractEntity
  24. {
  25. use \Plugin\EccubePaymentLite42\Entity\ProductClassTrait;
  26. private $price01_inc_tax = null;
  27. private $price02_inc_tax = null;
  28. private $tax_rate = false;
  29. /**
  30. * 商品規格名を含めた商品名を返す.
  31. *
  32. * @return string
  33. */
  34. public function formattedProductName()
  35. {
  36. $productName = $this->getProduct()->getName();
  37. if ($this->hasClassCategory1()) {
  38. $productName .= ' - '.$this->getClassCategory1()->getName();
  39. }
  40. if ($this->hasClassCategory2()) {
  41. $productName .= ' - '.$this->getClassCategory2()->getName();
  42. }
  43. return $productName;
  44. }
  45. /**
  46. * Is Enable
  47. *
  48. * @return bool
  49. *
  50. * @deprecated
  51. */
  52. public function isEnable()
  53. {
  54. return $this->getProduct()->isEnable();
  55. }
  56. /**
  57. * Set price01 IncTax
  58. *
  59. * @param string $price01_inc_tax
  60. *
  61. * @return ProductClass
  62. */
  63. public function setPrice01IncTax($price01_inc_tax)
  64. {
  65. $this->price01_inc_tax = $price01_inc_tax;
  66. return $this;
  67. }
  68. /**
  69. * Get price01 IncTax
  70. *
  71. * @return string
  72. */
  73. public function getPrice01IncTax()
  74. {
  75. return $this->price01_inc_tax;
  76. }
  77. /**
  78. * Set price02 IncTax
  79. *
  80. * @return ProductClass
  81. */
  82. public function setPrice02IncTax($price02_inc_tax)
  83. {
  84. $this->price02_inc_tax = $price02_inc_tax;
  85. return $this;
  86. }
  87. /**
  88. * Get price02 IncTax
  89. *
  90. * @return string
  91. */
  92. public function getPrice02IncTax()
  93. {
  94. return $this->price02_inc_tax;
  95. }
  96. /**
  97. * Get StockFind
  98. *
  99. * @return bool
  100. */
  101. public function getStockFind()
  102. {
  103. if ($this->getStock() > 0 || $this->isStockUnlimited()) {
  104. return true;
  105. } else {
  106. return false;
  107. }
  108. }
  109. /**
  110. * Set tax_rate
  111. *
  112. * @param string $tax_rate
  113. *
  114. * @return ProductClass
  115. */
  116. public function setTaxRate($tax_rate)
  117. {
  118. $this->tax_rate = $tax_rate;
  119. return $this;
  120. }
  121. /**
  122. * Get tax_rate
  123. *
  124. * @return boolean
  125. */
  126. public function getTaxRate()
  127. {
  128. return $this->tax_rate;
  129. }
  130. /**
  131. * Has ClassCategory1
  132. *
  133. * @return boolean
  134. */
  135. public function hasClassCategory1()
  136. {
  137. return isset($this->ClassCategory1);
  138. }
  139. /**
  140. * Has ClassCategory1
  141. *
  142. * @return boolean
  143. */
  144. public function hasClassCategory2()
  145. {
  146. return isset($this->ClassCategory2);
  147. }
  148. /**
  149. * @var int
  150. *
  151. * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  152. * @ORM\Id
  153. * @ORM\GeneratedValue(strategy="IDENTITY")
  154. */
  155. private $id;
  156. /**
  157. * @var string|null
  158. *
  159. * @ORM\Column(name="product_code", type="string", length=255, nullable=true)
  160. */
  161. private $code;
  162. /**
  163. * @var string|null
  164. *
  165. * @ORM\Column(name="stock", type="decimal", precision=10, scale=0, nullable=true)
  166. */
  167. private $stock;
  168. /**
  169. * @var boolean
  170. *
  171. * @ORM\Column(name="stock_unlimited", type="boolean", options={"default":false})
  172. */
  173. private $stock_unlimited = false;
  174. /**
  175. * @var string|null
  176. *
  177. * @ORM\Column(name="sale_limit", type="decimal", precision=10, scale=0, nullable=true, options={"unsigned":true})
  178. */
  179. private $sale_limit;
  180. /**
  181. * @var string|null
  182. *
  183. * @ORM\Column(name="price01", type="decimal", precision=12, scale=2, nullable=true)
  184. */
  185. private $price01;
  186. /**
  187. * @var string
  188. *
  189. * @ORM\Column(name="price02", type="decimal", precision=12, scale=2)
  190. */
  191. private $price02;
  192. /**
  193. * @var string|null
  194. *
  195. * @ORM\Column(name="delivery_fee", type="decimal", precision=12, scale=2, nullable=true, options={"unsigned":true})
  196. */
  197. private $delivery_fee;
  198. /**
  199. * @var boolean
  200. *
  201. * @ORM\Column(name="visible", type="boolean", options={"default":true})
  202. */
  203. private $visible;
  204. /**
  205. * @var \DateTime
  206. *
  207. * @ORM\Column(name="create_date", type="datetimetz")
  208. */
  209. private $create_date;
  210. /**
  211. * @var \DateTime
  212. *
  213. * @ORM\Column(name="update_date", type="datetimetz")
  214. */
  215. private $update_date;
  216. /**
  217. * @var string|null
  218. *
  219. * @ORM\Column(name="currency_code", type="string", nullable=true)
  220. */
  221. private $currency_code;
  222. /**
  223. * @var string
  224. *
  225. * @ORM\Column(name="point_rate", type="decimal", precision=10, scale=0, options={"unsigned":true}, nullable=true)
  226. */
  227. private $point_rate;
  228. /**
  229. * @var \Eccube\Entity\ProductStock
  230. *
  231. * @ORM\OneToOne(targetEntity="Eccube\Entity\ProductStock", mappedBy="ProductClass", cascade={"persist","remove"})
  232. */
  233. private $ProductStock;
  234. /**
  235. * @var \Eccube\Entity\TaxRule
  236. *
  237. * @ORM\OneToOne(targetEntity="Eccube\Entity\TaxRule", mappedBy="ProductClass", cascade={"persist","remove"})
  238. */
  239. private $TaxRule;
  240. /**
  241. * @var \Eccube\Entity\Product
  242. *
  243. * @ORM\ManyToOne(targetEntity="Eccube\Entity\Product", inversedBy="ProductClasses")
  244. * @ORM\JoinColumns({
  245. * @ORM\JoinColumn(name="product_id", referencedColumnName="id")
  246. * })
  247. */
  248. private $Product;
  249. /**
  250. * @var \Eccube\Entity\Master\SaleType
  251. *
  252. * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\SaleType")
  253. * @ORM\JoinColumns({
  254. * @ORM\JoinColumn(name="sale_type_id", referencedColumnName="id")
  255. * })
  256. */
  257. private $SaleType;
  258. /**
  259. * @var \Eccube\Entity\ClassCategory
  260. *
  261. * @ORM\ManyToOne(targetEntity="Eccube\Entity\ClassCategory")
  262. * @ORM\JoinColumns({
  263. * @ORM\JoinColumn(name="class_category_id1", referencedColumnName="id", nullable=true)
  264. * })
  265. */
  266. private $ClassCategory1;
  267. /**
  268. * @var \Eccube\Entity\ClassCategory
  269. *
  270. * @ORM\ManyToOne(targetEntity="Eccube\Entity\ClassCategory")
  271. * @ORM\JoinColumns({
  272. * @ORM\JoinColumn(name="class_category_id2", referencedColumnName="id", nullable=true)
  273. * })
  274. */
  275. private $ClassCategory2;
  276. /**
  277. * @var \Eccube\Entity\DeliveryDuration
  278. *
  279. * @ORM\ManyToOne(targetEntity="Eccube\Entity\DeliveryDuration")
  280. * @ORM\JoinColumns({
  281. * @ORM\JoinColumn(name="delivery_duration_id", referencedColumnName="id")
  282. * })
  283. */
  284. private $DeliveryDuration;
  285. /**
  286. * @var \Eccube\Entity\Member
  287. *
  288. * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
  289. * @ORM\JoinColumns({
  290. * @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
  291. * })
  292. */
  293. private $Creator;
  294. public function __clone()
  295. {
  296. $this->id = null;
  297. }
  298. /**
  299. * Get id.
  300. *
  301. * @return int
  302. */
  303. public function getId()
  304. {
  305. return $this->id;
  306. }
  307. /**
  308. * Set code.
  309. *
  310. * @param string|null $code
  311. *
  312. * @return ProductClass
  313. */
  314. public function setCode($code = null)
  315. {
  316. $this->code = $code;
  317. return $this;
  318. }
  319. /**
  320. * Get code.
  321. *
  322. * @return string|null
  323. */
  324. public function getCode()
  325. {
  326. return $this->code;
  327. }
  328. /**
  329. * Set stock.
  330. *
  331. * @param string|null $stock
  332. *
  333. * @return ProductClass
  334. */
  335. public function setStock($stock = null)
  336. {
  337. $this->stock = $stock;
  338. return $this;
  339. }
  340. /**
  341. * Get stock.
  342. *
  343. * @return string|null
  344. */
  345. public function getStock()
  346. {
  347. return $this->stock;
  348. }
  349. /**
  350. * Set stockUnlimited.
  351. *
  352. * @param boolean $stockUnlimited
  353. *
  354. * @return ProductClass
  355. */
  356. public function setStockUnlimited($stockUnlimited)
  357. {
  358. $this->stock_unlimited = $stockUnlimited;
  359. return $this;
  360. }
  361. /**
  362. * Get stockUnlimited.
  363. *
  364. * @return boolean
  365. */
  366. public function isStockUnlimited()
  367. {
  368. return $this->stock_unlimited;
  369. }
  370. /**
  371. * Set saleLimit.
  372. *
  373. * @param string|null $saleLimit
  374. *
  375. * @return ProductClass
  376. */
  377. public function setSaleLimit($saleLimit = null)
  378. {
  379. $this->sale_limit = $saleLimit;
  380. return $this;
  381. }
  382. /**
  383. * Get saleLimit.
  384. *
  385. * @return string|null
  386. */
  387. public function getSaleLimit()
  388. {
  389. return $this->sale_limit;
  390. }
  391. /**
  392. * Set price01.
  393. *
  394. * @param string|null $price01
  395. *
  396. * @return ProductClass
  397. */
  398. public function setPrice01($price01 = null)
  399. {
  400. $this->price01 = $price01;
  401. return $this;
  402. }
  403. /**
  404. * Get price01.
  405. *
  406. * @return string|null
  407. */
  408. public function getPrice01()
  409. {
  410. return $this->price01;
  411. }
  412. /**
  413. * Set price02.
  414. *
  415. * @param string $price02
  416. *
  417. * @return ProductClass
  418. */
  419. public function setPrice02($price02)
  420. {
  421. $this->price02 = $price02;
  422. return $this;
  423. }
  424. /**
  425. * Get price02.
  426. *
  427. * @return string
  428. */
  429. public function getPrice02()
  430. {
  431. return $this->price02;
  432. }
  433. /**
  434. * Set deliveryFee.
  435. *
  436. * @param string|null $deliveryFee
  437. *
  438. * @return ProductClass
  439. */
  440. public function setDeliveryFee($deliveryFee = null)
  441. {
  442. $this->delivery_fee = $deliveryFee;
  443. return $this;
  444. }
  445. /**
  446. * Get deliveryFee.
  447. *
  448. * @return string|null
  449. */
  450. public function getDeliveryFee()
  451. {
  452. return $this->delivery_fee;
  453. }
  454. /**
  455. * @return boolean
  456. */
  457. public function isVisible()
  458. {
  459. return $this->visible;
  460. }
  461. /**
  462. * @param boolean $visible
  463. *
  464. * @return ProductClass
  465. */
  466. public function setVisible($visible)
  467. {
  468. $this->visible = $visible;
  469. return $this;
  470. }
  471. /**
  472. * Set createDate.
  473. *
  474. * @param \DateTime $createDate
  475. *
  476. * @return ProductClass
  477. */
  478. public function setCreateDate($createDate)
  479. {
  480. $this->create_date = $createDate;
  481. return $this;
  482. }
  483. /**
  484. * Get createDate.
  485. *
  486. * @return \DateTime
  487. */
  488. public function getCreateDate()
  489. {
  490. return $this->create_date;
  491. }
  492. /**
  493. * Set updateDate.
  494. *
  495. * @param \DateTime $updateDate
  496. *
  497. * @return ProductClass
  498. */
  499. public function setUpdateDate($updateDate)
  500. {
  501. $this->update_date = $updateDate;
  502. return $this;
  503. }
  504. /**
  505. * Get updateDate.
  506. *
  507. * @return \DateTime
  508. */
  509. public function getUpdateDate()
  510. {
  511. return $this->update_date;
  512. }
  513. /**
  514. * Get currencyCode.
  515. *
  516. * @return string
  517. */
  518. public function getCurrencyCode()
  519. {
  520. return $this->currency_code;
  521. }
  522. /**
  523. * Set currencyCode.
  524. *
  525. * @param string|null $currencyCode
  526. *
  527. * @return $this
  528. */
  529. public function setCurrencyCode($currencyCode = null)
  530. {
  531. $this->currency_code = $currencyCode;
  532. return $this;
  533. }
  534. /**
  535. * Set productStock.
  536. *
  537. * @param \Eccube\Entity\ProductStock|null $productStock
  538. *
  539. * @return ProductClass
  540. */
  541. public function setProductStock(ProductStock $productStock = null)
  542. {
  543. $this->ProductStock = $productStock;
  544. return $this;
  545. }
  546. /**
  547. * Get productStock.
  548. *
  549. * @return \Eccube\Entity\ProductStock|null
  550. */
  551. public function getProductStock()
  552. {
  553. return $this->ProductStock;
  554. }
  555. /**
  556. * Set taxRule.
  557. *
  558. * @param \Eccube\Entity\TaxRule|null $taxRule
  559. *
  560. * @return ProductClass
  561. */
  562. public function setTaxRule(TaxRule $taxRule = null)
  563. {
  564. $this->TaxRule = $taxRule;
  565. return $this;
  566. }
  567. /**
  568. * Get taxRule.
  569. *
  570. * @return \Eccube\Entity\TaxRule|null
  571. */
  572. public function getTaxRule()
  573. {
  574. return $this->TaxRule;
  575. }
  576. /**
  577. * Set product.
  578. *
  579. * @param \Eccube\Entity\Product|null $product
  580. *
  581. * @return ProductClass
  582. */
  583. public function setProduct(Product $product = null)
  584. {
  585. $this->Product = $product;
  586. return $this;
  587. }
  588. /**
  589. * Get product.
  590. *
  591. * @return \Eccube\Entity\Product|null
  592. */
  593. public function getProduct()
  594. {
  595. return $this->Product;
  596. }
  597. /**
  598. * Set saleType.
  599. *
  600. * @param \Eccube\Entity\Master\SaleType|null $saleType
  601. *
  602. * @return ProductClass
  603. */
  604. public function setSaleType(Master\SaleType $saleType = null)
  605. {
  606. $this->SaleType = $saleType;
  607. return $this;
  608. }
  609. /**
  610. * Get saleType.
  611. *
  612. * @return \Eccube\Entity\Master\SaleType|null
  613. */
  614. public function getSaleType()
  615. {
  616. return $this->SaleType;
  617. }
  618. /**
  619. * Set classCategory1.
  620. *
  621. * @param \Eccube\Entity\ClassCategory|null $classCategory1
  622. *
  623. * @return ProductClass
  624. */
  625. public function setClassCategory1(ClassCategory $classCategory1 = null)
  626. {
  627. $this->ClassCategory1 = $classCategory1;
  628. return $this;
  629. }
  630. /**
  631. * Get classCategory1.
  632. *
  633. * @return \Eccube\Entity\ClassCategory|null
  634. */
  635. public function getClassCategory1()
  636. {
  637. return $this->ClassCategory1;
  638. }
  639. /**
  640. * Set classCategory2.
  641. *
  642. * @param \Eccube\Entity\ClassCategory|null $classCategory2
  643. *
  644. * @return ProductClass
  645. */
  646. public function setClassCategory2(ClassCategory $classCategory2 = null)
  647. {
  648. $this->ClassCategory2 = $classCategory2;
  649. return $this;
  650. }
  651. /**
  652. * Get classCategory2.
  653. *
  654. * @return \Eccube\Entity\ClassCategory|null
  655. */
  656. public function getClassCategory2()
  657. {
  658. return $this->ClassCategory2;
  659. }
  660. /**
  661. * Set deliveryDuration.
  662. *
  663. * @param \Eccube\Entity\DeliveryDuration|null $deliveryDuration
  664. *
  665. * @return ProductClass
  666. */
  667. public function setDeliveryDuration(DeliveryDuration $deliveryDuration = null)
  668. {
  669. $this->DeliveryDuration = $deliveryDuration;
  670. return $this;
  671. }
  672. /**
  673. * Get deliveryDuration.
  674. *
  675. * @return \Eccube\Entity\DeliveryDuration|null
  676. */
  677. public function getDeliveryDuration()
  678. {
  679. return $this->DeliveryDuration;
  680. }
  681. /**
  682. * Set creator.
  683. *
  684. * @param \Eccube\Entity\Member|null $creator
  685. *
  686. * @return ProductClass
  687. */
  688. public function setCreator(Member $creator = null)
  689. {
  690. $this->Creator = $creator;
  691. return $this;
  692. }
  693. /**
  694. * Get creator.
  695. *
  696. * @return \Eccube\Entity\Member|null
  697. */
  698. public function getCreator()
  699. {
  700. return $this->Creator;
  701. }
  702. /**
  703. * Set pointRate
  704. *
  705. * @param string $pointRate
  706. *
  707. * @return ProductClass
  708. */
  709. public function setPointRate($pointRate)
  710. {
  711. $this->point_rate = $pointRate;
  712. return $this;
  713. }
  714. /**
  715. * Get pointRate
  716. *
  717. * @return string
  718. */
  719. public function getPointRate()
  720. {
  721. return $this->point_rate;
  722. }
  723. }