No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

370 líneas
8.4KB

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