292 linhas
8.6KB

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