Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

272 lines
8.0KB

  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * @ORM\MappedSuperclass()
  8. */
  9. abstract class OrderShop extends AbstractEntity
  10. {
  11. /**
  12. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="orders")
  13. * @ORM\JoinColumn(nullable=false)
  14. */
  15. protected $user;
  16. /**
  17. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface", inversedBy="order")
  18. * @ORM\JoinColumn(nullable=false)
  19. */
  20. protected $invoiceAddress;
  21. /**
  22. * @ORM\Column(type="text", nullable=true)
  23. */
  24. protected $comment;
  25. /**
  26. * @ORM\Column(type="boolean")
  27. */
  28. protected $autoPayment;
  29. /**
  30. * @ORM\Column(type="string", length=31)
  31. */
  32. protected $meanPayment;
  33. /**
  34. * @ORM\Column(type="boolean", nullable=true)
  35. */
  36. protected $tillerSynchronisation;
  37. /**
  38. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderStatusHistoryInterface", mappedBy="orderShop", orphanRemoval=true)
  39. */
  40. protected $orderStatusHistories;
  41. /**
  42. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderProductInterface", mappedBy="orderShop", orphanRemoval=true)
  43. */
  44. protected $orderProducts;
  45. /**
  46. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\CreditHistoryInterface", mappedBy="orderShop", orphanRemoval=true)
  47. */
  48. protected $creditHistories;
  49. /**
  50. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\DocumentInvoiceInterface", inversedBy="orderShops")
  51. */
  52. protected $documentInvoice;
  53. /**
  54. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\DocumentQuotationInterface", inversedBy="orderShops")
  55. */
  56. protected $documentQuotation;
  57. /**
  58. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\DocumentDeliveryNoteInterface", inversedBy="orderShops")
  59. */
  60. protected $documentDeliveryNote;
  61. public function __construct()
  62. {
  63. $this->orderStatusHistories = new ArrayCollection();
  64. $this->orderProducts = new ArrayCollection();
  65. $this->creditHistories = new ArrayCollection();
  66. }
  67. public function getUser(): ?User
  68. {
  69. return $this->user;
  70. }
  71. public function setUser(?User $user): self
  72. {
  73. $this->user = $user;
  74. return $this;
  75. }
  76. public function getInvoiceAddress(): ?Address
  77. {
  78. return $this->invoiceAddress;
  79. }
  80. public function setInvoiceAddress(?Address $invoiceAddress): self
  81. {
  82. $this->invoiceAddress = $invoiceAddress;
  83. return $this;
  84. }
  85. public function getComment(): ?string
  86. {
  87. return $this->comment;
  88. }
  89. public function setComment(?string $comment): self
  90. {
  91. $this->comment = $comment;
  92. return $this;
  93. }
  94. public function getAutoPayment(): ?bool
  95. {
  96. return $this->autoPayment;
  97. }
  98. public function setAutoPayment(bool $autoPayment): self
  99. {
  100. $this->autoPayment = $autoPayment;
  101. return $this;
  102. }
  103. public function getMeanPayment(): ?string
  104. {
  105. return $this->meanPayment;
  106. }
  107. public function setMeanPayment(string $meanPayment): self
  108. {
  109. $this->meanPayment = $meanPayment;
  110. return $this;
  111. }
  112. /**
  113. * @return Collection|OrderStatusHistory[]
  114. */
  115. public function getOrderStatusHistories(): Collection
  116. {
  117. return $this->orderStatusHistories;
  118. }
  119. public function addOrderStatusHistory(OrderStatusHistory $orderStatusHistory): self
  120. {
  121. if (!$this->orderStatusHistories->contains($orderStatusHistory)) {
  122. $this->orderStatusHistories[] = $orderStatusHistory;
  123. $orderStatusHistory->setOrderShop($this);
  124. }
  125. return $this;
  126. }
  127. public function removeOrderStatusHistory(OrderStatusHistory $orderStatusHistory): self
  128. {
  129. if ($this->orderStatusHistories->contains($orderStatusHistory)) {
  130. $this->orderStatusHistories->removeElement($orderStatusHistory);
  131. // set the owning side to null (unless already changed)
  132. if ($orderStatusHistory->getOrderShop() === $this) {
  133. $orderStatusHistory->setOrderShop(null);
  134. }
  135. }
  136. return $this;
  137. }
  138. /**
  139. * @return Collection|OrderProduct[]
  140. */
  141. public function getOrderProducts(): Collection
  142. {
  143. return $this->orderProducts;
  144. }
  145. public function addOrderProduct(OrderProduct $orderProduct): self
  146. {
  147. if (!$this->orderProducts->contains($orderProduct)) {
  148. $this->orderProducts[] = $orderProduct;
  149. $orderProduct->setOrderShop($this);
  150. }
  151. return $this;
  152. }
  153. public function removeOrderProduct(OrderProduct $orderProduct): self
  154. {
  155. if ($this->orderProducts->contains($orderProduct)) {
  156. $this->orderProducts->removeElement($orderProduct);
  157. // set the owning side to null (unless already changed)
  158. if ($orderProduct->getOrderShop() === $this) {
  159. $orderProduct->setOrderShop(null);
  160. }
  161. }
  162. return $this;
  163. }
  164. /**
  165. * @return Collection|CreditHistory[]
  166. */
  167. public function getCreditHistories(): Collection
  168. {
  169. return $this->creditHistories;
  170. }
  171. public function addCreditHistory(CreditHistory $creditHistory): self
  172. {
  173. if (!$this->creditHistories->contains($creditHistory)) {
  174. $this->creditHistories[] = $creditHistory;
  175. $creditHistory->setOrderShop($this);
  176. }
  177. return $this;
  178. }
  179. public function removeCreditHistory(CreditHistory $creditHistory): self
  180. {
  181. if ($this->creditHistories->contains($creditHistory)) {
  182. $this->creditHistories->removeElement($creditHistory);
  183. // set the owning side to null (unless already changed)
  184. if ($creditHistory->getOrderShop() === $this) {
  185. $creditHistory->setOrderShop(null);
  186. }
  187. }
  188. return $this;
  189. }
  190. public function getDocumentInvoice(): ?DocumentInvoice
  191. {
  192. return $this->documentInvoice;
  193. }
  194. public function setDocumentInvoice(?DocumentInvoice $documentInvoice): self
  195. {
  196. $this->documentInvoice = $documentInvoice;
  197. return $this;
  198. }
  199. public function getDocumentQuotation(): ?DocumentQuotation
  200. {
  201. return $this->documentQuotation;
  202. }
  203. public function setDocumentQuotation(?DocumentQuotation $documentQuotation): self
  204. {
  205. $this->documentQuotation = $documentQuotation;
  206. return $this;
  207. }
  208. public function getDocumentDeliveryNote(): ?DocumentDeliveryNote
  209. {
  210. return $this->documentDeliveryNote;
  211. }
  212. public function setDocumentDeliveryNote(?DocumentDeliveryNote $documentDeliveryNote): self
  213. {
  214. $this->documentDeliveryNote = $documentDeliveryNote;
  215. return $this;
  216. }
  217. }