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

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