Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

325 lines
9.3KB

  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 extends AbstractEntity 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", cascade={"persist", "remove"}, 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. /**
  71. * @ORM\Column(type="text", nullable=true)
  72. */
  73. protected $infosDelivery;
  74. public function __construct()
  75. {
  76. $this->orderStatusHistories = new ArrayCollection();
  77. $this->orderProducts = new ArrayCollection();
  78. $this->creditHistories = new ArrayCollection();
  79. }
  80. public function getMerchant(): ?Merchant
  81. {
  82. return $this->merchant;
  83. }
  84. public function setMerchant(?Merchant $merchant): self
  85. {
  86. $this->merchant = $merchant;
  87. return $this;
  88. }
  89. public function getUser(): ?User
  90. {
  91. return $this->user;
  92. }
  93. public function setUser(?User $user): self
  94. {
  95. $this->user = $user;
  96. return $this;
  97. }
  98. public function getInvoiceAddress(): ?Address
  99. {
  100. return $this->invoiceAddress;
  101. }
  102. public function setInvoiceAddress(?Address $invoiceAddress): self
  103. {
  104. $this->invoiceAddress = $invoiceAddress;
  105. return $this;
  106. }
  107. public function getComment(): ?string
  108. {
  109. return $this->comment;
  110. }
  111. public function setComment(?string $comment): self
  112. {
  113. $this->comment = $comment;
  114. return $this;
  115. }
  116. public function getAutoPayment(): ?bool
  117. {
  118. return $this->autoPayment;
  119. }
  120. public function setAutoPayment(bool $autoPayment): self
  121. {
  122. $this->autoPayment = $autoPayment;
  123. return $this;
  124. }
  125. public function getMeanPayment(): ?string
  126. {
  127. return $this->meanPayment;
  128. }
  129. public function setMeanPayment(string $meanPayment): self
  130. {
  131. $this->meanPayment = $meanPayment;
  132. return $this;
  133. }
  134. /**
  135. * @return Collection|OrderStatusHistory[]
  136. */
  137. public function getOrderStatusHistories(): Collection
  138. {
  139. return $this->orderStatusHistories;
  140. }
  141. public function addOrderStatusHistory(OrderStatusHistory $orderStatusHistory): self
  142. {
  143. if (!$this->orderStatusHistories->contains($orderStatusHistory)) {
  144. $this->orderStatusHistories[] = $orderStatusHistory;
  145. $orderStatusHistory->setOrderShop($this);
  146. }
  147. return $this;
  148. }
  149. public function removeOrderStatusHistory(OrderStatusHistory $orderStatusHistory): self
  150. {
  151. if ($this->orderStatusHistories->contains($orderStatusHistory)) {
  152. $this->orderStatusHistories->removeElement($orderStatusHistory);
  153. // set the owning side to null (unless already changed)
  154. if ($orderStatusHistory->getOrderShop() === $this) {
  155. $orderStatusHistory->setOrderShop(null);
  156. }
  157. }
  158. return $this;
  159. }
  160. /**
  161. * @return Collection|OrderProduct[]
  162. */
  163. public function getOrderProducts(): Collection
  164. {
  165. return $this->orderProducts;
  166. }
  167. public function addOrderProduct(OrderProduct $orderProduct): self
  168. {
  169. if (!$this->orderProducts->contains($orderProduct)) {
  170. $this->orderProducts[] = $orderProduct;
  171. $orderProduct->setOrderShop($this);
  172. }
  173. return $this;
  174. }
  175. public function removeOrderProduct(OrderProduct $orderProduct): self
  176. {
  177. if ($this->orderProducts->contains($orderProduct)) {
  178. $this->orderProducts->removeElement($orderProduct);
  179. // set the owning side to null (unless already changed)
  180. if ($orderProduct->getOrderShop() === $this) {
  181. $orderProduct->setOrderShop(null);
  182. }
  183. }
  184. return $this;
  185. }
  186. /**
  187. * @return Collection|CreditHistory[]
  188. */
  189. public function getCreditHistories(): Collection
  190. {
  191. return $this->creditHistories;
  192. }
  193. public function addCreditHistory(CreditHistory $creditHistory): self
  194. {
  195. if (!$this->creditHistories->contains($creditHistory)) {
  196. $this->creditHistories[] = $creditHistory;
  197. $creditHistory->setOrderShop($this);
  198. }
  199. return $this;
  200. }
  201. public function removeCreditHistory(CreditHistory $creditHistory): self
  202. {
  203. if ($this->creditHistories->contains($creditHistory)) {
  204. $this->creditHistories->removeElement($creditHistory);
  205. // set the owning side to null (unless already changed)
  206. if ($creditHistory->getOrderShop() === $this) {
  207. $creditHistory->setOrderShop(null);
  208. }
  209. }
  210. return $this;
  211. }
  212. public function getDocumentInvoice(): ?DocumentInvoice
  213. {
  214. return $this->documentInvoice;
  215. }
  216. public function setDocumentInvoice(?DocumentInvoice $documentInvoice): self
  217. {
  218. $this->documentInvoice = $documentInvoice;
  219. return $this;
  220. }
  221. public function getDocumentQuotation(): ?DocumentQuotation
  222. {
  223. return $this->documentQuotation;
  224. }
  225. public function setDocumentQuotation(?DocumentQuotation $documentQuotation): self
  226. {
  227. $this->documentQuotation = $documentQuotation;
  228. return $this;
  229. }
  230. public function getDocumentDeliveryNote(): ?DocumentDeliveryNote
  231. {
  232. return $this->documentDeliveryNote;
  233. }
  234. public function setDocumentDeliveryNote(?DocumentDeliveryNote $documentDeliveryNote): self
  235. {
  236. $this->documentDeliveryNote = $documentDeliveryNote;
  237. return $this;
  238. }
  239. public function getVisitor(): ?Visitor
  240. {
  241. return $this->visitor;
  242. }
  243. public function setVisitor(?Visitor $visitor): self
  244. {
  245. $this->visitor = $visitor;
  246. return $this;
  247. }
  248. public function getInfosDelivery(): ?string
  249. {
  250. return $this->infosDelivery;
  251. }
  252. public function setInfosDelivery(?string $infosDelivery): self
  253. {
  254. $this->infosDelivery = $infosDelivery;
  255. return $this;
  256. }
  257. }