Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

143 rindas
3.1KB

  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * @ORM\MappedSuperclass()
  6. */
  7. abstract class OrderProduct extends AbstractEntity
  8. {
  9. /**
  10. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderProducts", cascade={"persist"})
  11. * @ORM\JoinColumn(nullable=false)
  12. */
  13. protected $orderShop;
  14. /**
  15. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\ProductInterface")
  16. */
  17. protected $product;
  18. /**
  19. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
  20. * @ORM\JoinColumn(nullable=false)
  21. */
  22. protected $taxRate;
  23. /**
  24. * @ORM\Column(type="float")
  25. */
  26. protected $price;
  27. /**
  28. * @ORM\Column(type="string", length=31)
  29. */
  30. protected $unit;
  31. /**
  32. * @ORM\Column(type="float")
  33. */
  34. protected $quantity;
  35. /**
  36. * @ORM\Column(type="string", length=255)
  37. */
  38. protected $title;
  39. public function __toString()
  40. {
  41. if($this->getTitle()) {
  42. return $this->getTitle();
  43. }else{
  44. return $this->getProduct()->getProductFamily()->getTitle(). ' - '.$this->getProduct()->getTitle();
  45. }
  46. }
  47. public function getOrderShop(): ?OrderShop
  48. {
  49. return $this->orderShop;
  50. }
  51. public function setOrderShop(?OrderShop $orderShop): self
  52. {
  53. $this->orderShop = $orderShop;
  54. return $this;
  55. }
  56. public function getProduct(): ?Product
  57. {
  58. return $this->product;
  59. }
  60. public function setProduct(?Product $product): self
  61. {
  62. $this->product = $product;
  63. return $this;
  64. }
  65. public function getTaxRate(): ?TaxRate
  66. {
  67. return $this->taxRate;
  68. }
  69. public function setTaxRate(?TaxRate $taxRate): self
  70. {
  71. $this->taxRate = $taxRate;
  72. return $this;
  73. }
  74. public function getPrice(): ?float
  75. {
  76. return $this->price;
  77. }
  78. public function setPrice(float $price): self
  79. {
  80. $this->price = $price;
  81. return $this;
  82. }
  83. public function getUnit(): ?string
  84. {
  85. return $this->unit;
  86. }
  87. public function setUnit(string $unit): self
  88. {
  89. $this->unit = $unit;
  90. return $this;
  91. }
  92. public function getQuantity(): ?float
  93. {
  94. return $this->quantity;
  95. }
  96. public function setQuantity(float $quantity): self
  97. {
  98. $this->quantity = $quantity;
  99. return $this;
  100. }
  101. public function getTitle(): ?string
  102. {
  103. return $this->title;
  104. }
  105. public function setTitle(string $title): self
  106. {
  107. $this->title = $title;
  108. return $this;
  109. }
  110. }