Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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