Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

Address.php 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  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. $html .= 'Tél. ' . $this->getPhone();
  107. }
  108. return $html;
  109. }
  110. public function getUser(): ?User
  111. {
  112. return $this->user;
  113. }
  114. public function setUser(?User $user): self
  115. {
  116. $this->user = $user;
  117. return $this;
  118. }
  119. public function getTitle(): ?string
  120. {
  121. return $this->title;
  122. }
  123. public function setTitle(string $title): self
  124. {
  125. $this->title = $title;
  126. return $this;
  127. }
  128. public function getType(): ?string
  129. {
  130. return $this->type;
  131. }
  132. public function setType(string $type): self
  133. {
  134. $this->type = $type;
  135. return $this;
  136. }
  137. public function getCivility(): ?bool
  138. {
  139. return $this->civility;
  140. }
  141. public function setCivility(?bool $civility): self
  142. {
  143. $this->civility = $civility;
  144. return $this;
  145. }
  146. public function getLastname(): ?string
  147. {
  148. return $this->lastname;
  149. }
  150. public function setLastname(?string $lastname): self
  151. {
  152. $this->lastname = $lastname;
  153. return $this;
  154. }
  155. public function getFirstname(): ?string
  156. {
  157. return $this->firstname;
  158. }
  159. public function setFirstname(?string $firstname): self
  160. {
  161. $this->firstname = $firstname;
  162. return $this;
  163. }
  164. public function getAddress(): ?string
  165. {
  166. return $this->address;
  167. }
  168. public function setAddress(string $address): self
  169. {
  170. $this->address = $address;
  171. return $this;
  172. }
  173. public function getZip(): ?string
  174. {
  175. return $this->zip;
  176. }
  177. public function setZip(string $zip): self
  178. {
  179. $this->zip = $zip;
  180. return $this;
  181. }
  182. public function getCity(): ?string
  183. {
  184. return $this->city;
  185. }
  186. public function setCity(string $city): self
  187. {
  188. $this->city = $city;
  189. return $this;
  190. }
  191. public function getCountry(): ?string
  192. {
  193. return $this->country;
  194. }
  195. public function setCountry(string $country): self
  196. {
  197. $this->country = $country;
  198. return $this;
  199. }
  200. public function getCompany(): ?string
  201. {
  202. return $this->company;
  203. }
  204. public function setCompany(?string $company): self
  205. {
  206. $this->company = $company;
  207. return $this;
  208. }
  209. public function getSiret(): ?string
  210. {
  211. return $this->siret;
  212. }
  213. public function setSiret(?string $siret): self
  214. {
  215. $this->siret = $siret;
  216. return $this;
  217. }
  218. public function getTva(): ?string
  219. {
  220. return $this->tva;
  221. }
  222. public function setTva(?string $tva): self
  223. {
  224. $this->tva = $tva;
  225. return $this;
  226. }
  227. public function getPhone(): ?array
  228. {
  229. return $this->phone;
  230. }
  231. public function setPhone(?array $phone): self
  232. {
  233. $this->phone = $phone;
  234. return $this;
  235. }
  236. public function getComment(): ?string
  237. {
  238. return $this->comment;
  239. }
  240. public function setComment(?string $comment): self
  241. {
  242. $this->comment = $comment;
  243. return $this;
  244. }
  245. public function getPointSale(): ?PointSale
  246. {
  247. return $this->pointSale;
  248. }
  249. public function setPointSale(PointSale $pointSale): self
  250. {
  251. $this->pointSale = $pointSale;
  252. // set the owning side of the relation if necessary
  253. if ($pointSale->getAddress() !== $this) {
  254. $pointSale->setAddress($this);
  255. }
  256. return $this;
  257. }
  258. public function getMerchant(): ?Merchant
  259. {
  260. return $this->merchant;
  261. }
  262. public function setMerchant(Merchant $merchant): self
  263. {
  264. $this->merchant = $merchant;
  265. // set the owning side of the relation if necessary
  266. if ($merchant->getAddress() !== $this) {
  267. $merchant->setAddress($this);
  268. }
  269. return $this;
  270. }
  271. public function getDeliveryInfos(): ?string
  272. {
  273. return $this->deliveryInfos;
  274. }
  275. public function setDeliveryInfos(?string $deliveryInfos): self
  276. {
  277. $this->deliveryInfos = $deliveryInfos;
  278. return $this;
  279. }
  280. }