308 lines
8.9KB

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