291 líneas
8.5KB

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