選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

355 行
8.1KB

  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 Address extends AbstractEntity
  10. {
  11. /**
  12. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="addresses")
  13. * @ORM\JoinColumn(nullable=true)
  14. */
  15. protected $user;
  16. /**
  17. * @ORM\Column(type="string", length=255)
  18. */
  19. protected $title;
  20. /**
  21. * @ORM\Column(type="string", length=31)
  22. */
  23. protected $type;
  24. /**
  25. * @ORM\Column(type="boolean", nullable=true)
  26. */
  27. protected $civility;
  28. /**
  29. * @ORM\Column(type="string", length=127, nullable=true)
  30. */
  31. protected $lastname;
  32. /**
  33. * @ORM\Column(type="string", length=127, nullable=true)
  34. */
  35. protected $firstname;
  36. /**
  37. * @ORM\Column(type="text")
  38. */
  39. protected $address;
  40. /**
  41. * @ORM\Column(type="string", length=31)
  42. */
  43. protected $zip;
  44. /**
  45. * @ORM\Column(type="string", length=255)
  46. */
  47. protected $city;
  48. /**
  49. * @ORM\Column(type="string", length=255)
  50. */
  51. protected $country;
  52. /**
  53. * @ORM\Column(type="string", length=255, nullable=true)
  54. */
  55. protected $company;
  56. /**
  57. * @ORM\Column(type="string", length=127, nullable=true)
  58. */
  59. protected $siret;
  60. /**
  61. * @ORM\Column(type="string", length=127, nullable=true)
  62. */
  63. protected $tva;
  64. /**
  65. * @ORM\Column(type="string", length=127, nullable=true)
  66. */
  67. protected $phone;
  68. /**
  69. * @ORM\Column(type="text", nullable=true)
  70. */
  71. protected $comment;
  72. /**
  73. * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="invoiceAddress")
  74. */
  75. protected $orders;
  76. /**
  77. * @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\PointSaleInterface", mappedBy="address", cascade={"persist", "remove"})
  78. */
  79. protected $pointSale;
  80. /**
  81. * @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", mappedBy="address", cascade={"persist", "remove"})
  82. */
  83. protected $merchant;
  84. public function __construct()
  85. {
  86. $this->shopOrders = new ArrayCollection();
  87. }
  88. public function getUser(): ?User
  89. {
  90. return $this->user;
  91. }
  92. public function setUser(?User $user): self
  93. {
  94. $this->user = $user;
  95. return $this;
  96. }
  97. public function getTitle(): ?string
  98. {
  99. return $this->title;
  100. }
  101. public function setTitle(string $title): self
  102. {
  103. $this->title = $title;
  104. return $this;
  105. }
  106. public function getType(): ?string
  107. {
  108. return $this->type;
  109. }
  110. public function setType(string $type): self
  111. {
  112. $this->type = $type;
  113. return $this;
  114. }
  115. public function getCivility(): ?bool
  116. {
  117. return $this->civility;
  118. }
  119. public function setCivility(?bool $civility): self
  120. {
  121. $this->civility = $civility;
  122. return $this;
  123. }
  124. public function getLastname(): ?string
  125. {
  126. return $this->lastname;
  127. }
  128. public function setLastname(?string $lastname): self
  129. {
  130. $this->lastname = $lastname;
  131. return $this;
  132. }
  133. public function getFirstname(): ?string
  134. {
  135. return $this->firstname;
  136. }
  137. public function setFirstname(?string $firstname): self
  138. {
  139. $this->firstname = $firstname;
  140. return $this;
  141. }
  142. public function getAddress(): ?string
  143. {
  144. return $this->address;
  145. }
  146. public function setAddress(string $address): self
  147. {
  148. $this->address = $address;
  149. return $this;
  150. }
  151. public function getZip(): ?string
  152. {
  153. return $this->zip;
  154. }
  155. public function setZip(string $zip): self
  156. {
  157. $this->zip = $zip;
  158. return $this;
  159. }
  160. public function getCity(): ?string
  161. {
  162. return $this->city;
  163. }
  164. public function setCity(string $city): self
  165. {
  166. $this->city = $city;
  167. return $this;
  168. }
  169. public function getCountry(): ?string
  170. {
  171. return $this->country;
  172. }
  173. public function setCountry(string $country): self
  174. {
  175. $this->country = $country;
  176. return $this;
  177. }
  178. public function getCompany(): ?string
  179. {
  180. return $this->company;
  181. }
  182. public function setCompany(?string $company): self
  183. {
  184. $this->company = $company;
  185. return $this;
  186. }
  187. public function getSiret(): ?string
  188. {
  189. return $this->siret;
  190. }
  191. public function setSiret(?string $siret): self
  192. {
  193. $this->siret = $siret;
  194. return $this;
  195. }
  196. public function getTva(): ?string
  197. {
  198. return $this->tva;
  199. }
  200. public function setTva(?string $tva): self
  201. {
  202. $this->tva = $tva;
  203. return $this;
  204. }
  205. public function getPhone(): ?string
  206. {
  207. return $this->phone;
  208. }
  209. public function setPhone(?string $phone): self
  210. {
  211. $this->phone = $phone;
  212. return $this;
  213. }
  214. public function getComment(): ?string
  215. {
  216. return $this->comment;
  217. }
  218. public function setComment(?string $comment): self
  219. {
  220. $this->comment = $comment;
  221. return $this;
  222. }
  223. /**
  224. * @return Collection|ShopOrder[]
  225. */
  226. public function getOrders(): Collection
  227. {
  228. return $this->orders;
  229. }
  230. public function addOrder(OrderShop $order): self
  231. {
  232. if (!$this->orders->contains($order)) {
  233. $this->orders[] = $order;
  234. $order->setInvoiceAddress($this);
  235. }
  236. return $this;
  237. }
  238. public function removeOrder(OrderShop $order): self
  239. {
  240. if ($this->orders->contains($order)) {
  241. $this->orders->removeElement($order);
  242. // set the owning side to null (unless already changed)
  243. if ($order->getInvoiceAddress() === $this) {
  244. $order->setInvoiceAddress(null);
  245. }
  246. }
  247. return $this;
  248. }
  249. public function getPointSale(): ?PointSale
  250. {
  251. return $this->pointSale;
  252. }
  253. public function setPointSale(PointSale $pointSale): self
  254. {
  255. $this->pointSale = $pointSale;
  256. // set the owning side of the relation if necessary
  257. if ($pointSale->getAddress() !== $this) {
  258. $pointSale->setAddress($this);
  259. }
  260. return $this;
  261. }
  262. public function getMerchant(): ?Merchant
  263. {
  264. return $this->merchant;
  265. }
  266. public function setMerchant(Merchant $merchant): self
  267. {
  268. $this->merchant = $merchant;
  269. // set the owning side of the relation if necessary
  270. if ($merchant->getAddress() !== $this) {
  271. $merchant->setAddress($this);
  272. }
  273. return $this;
  274. }
  275. }