You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

422 lines
8.1KB

  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, AddressInterface
  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="string", length=32, nullable=true)
  77. */
  78. protected $latitude;
  79. /**
  80. * @ORM\Column(type="string", length=32, nullable=true)
  81. */
  82. protected $longitude;
  83. /**
  84. * @ORM\Column(type="string", length=32, nullable=true)
  85. */
  86. protected $latitudeOverride;
  87. /**
  88. * @ORM\Column(type="string", length=32, nullable=true)
  89. */
  90. protected $longitudeOverride;
  91. /**
  92. * @ORM\Column(type="text", nullable=true)
  93. */
  94. protected $comment;
  95. /**
  96. * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\PointSale\PointSaleInterface", mappedBy="address", cascade={"persist", "remove"})
  97. */
  98. protected $pointSale;
  99. /**
  100. * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", mappedBy="address", cascade={"persist", "remove"})
  101. */
  102. protected $merchant;
  103. /**
  104. * @ORM\Column(type="text", nullable=true)
  105. */
  106. protected $deliveryInfos;
  107. public function __construct()
  108. {
  109. $this->phone = [];
  110. }
  111. public function __toString()
  112. {
  113. return $this->getTitle() . ' - ' . $this->getZip() . ' ' . $this->getCity();
  114. }
  115. public function getUser(): ?UserInterface
  116. {
  117. return $this->user;
  118. }
  119. public function setUser(?UserInterface $user): self
  120. {
  121. $this->user = $user;
  122. return $this;
  123. }
  124. public function getTitle(): ?string
  125. {
  126. return $this->title;
  127. }
  128. public function setTitle(string $title): self
  129. {
  130. $this->title = $title;
  131. return $this;
  132. }
  133. public function getType(): ?string
  134. {
  135. return $this->type;
  136. }
  137. public function setType(string $type): self
  138. {
  139. $this->type = $type;
  140. return $this;
  141. }
  142. public function getCivility(): ?bool
  143. {
  144. return $this->civility;
  145. }
  146. public function setCivility(?bool $civility): self
  147. {
  148. $this->civility = $civility;
  149. return $this;
  150. }
  151. public function getLastname(): ?string
  152. {
  153. return $this->lastname;
  154. }
  155. public function setLastname(?string $lastname): self
  156. {
  157. $this->lastname = $lastname;
  158. return $this;
  159. }
  160. public function getFirstname(): ?string
  161. {
  162. return $this->firstname;
  163. }
  164. public function setFirstname(?string $firstname): self
  165. {
  166. $this->firstname = $firstname;
  167. return $this;
  168. }
  169. public function getAddress(): ?string
  170. {
  171. return $this->address;
  172. }
  173. public function setAddress(string $address): self
  174. {
  175. $this->address = $address;
  176. return $this;
  177. }
  178. public function getZip(): ?string
  179. {
  180. return $this->zip;
  181. }
  182. public function setZip(string $zip): self
  183. {
  184. $this->zip = $zip;
  185. return $this;
  186. }
  187. public function getCity(): ?string
  188. {
  189. return $this->city;
  190. }
  191. public function setCity(string $city): self
  192. {
  193. $this->city = $city;
  194. return $this;
  195. }
  196. public function getCountry(): ?string
  197. {
  198. return $this->country;
  199. }
  200. public function setCountry(string $country): self
  201. {
  202. $this->country = $country;
  203. return $this;
  204. }
  205. public function getLatitude(): ?string
  206. {
  207. return $this->latitude;
  208. }
  209. public function setLatitude(?string $latitude): self
  210. {
  211. $this->latitude = $latitude;
  212. return $this;
  213. }
  214. public function getLongitude(): ?string
  215. {
  216. return $this->longitude;
  217. }
  218. public function setLongitude(?string $longitude): self
  219. {
  220. $this->longitude = $longitude;
  221. return $this;
  222. }
  223. public function getLatitudeOverride(): ?string
  224. {
  225. return $this->latitudeOverride;
  226. }
  227. public function setLatitudeOverride(?string $latitudeOverride): self
  228. {
  229. $this->latitudeOverride = $latitudeOverride;
  230. return $this;
  231. }
  232. public function getLongitudeOverride(): ?string
  233. {
  234. return $this->longitudeOverride;
  235. }
  236. public function setLongitudeOverride(?string $longitudeOverride): self
  237. {
  238. $this->longitudeOverride = $longitudeOverride;
  239. return $this;
  240. }
  241. public function getCompany(): ?string
  242. {
  243. return $this->company;
  244. }
  245. public function setCompany(?string $company): self
  246. {
  247. $this->company = $company;
  248. return $this;
  249. }
  250. public function getSiret(): ?string
  251. {
  252. return $this->siret;
  253. }
  254. public function setSiret(?string $siret): self
  255. {
  256. $this->siret = $siret;
  257. return $this;
  258. }
  259. public function getTva(): ?string
  260. {
  261. return $this->tva;
  262. }
  263. public function setTva(?string $tva): self
  264. {
  265. $this->tva = $tva;
  266. return $this;
  267. }
  268. public function getPhone(): ?array
  269. {
  270. return $this->phone;
  271. }
  272. public function setPhone(?array $phone): self
  273. {
  274. $this->phone = $phone;
  275. return $this;
  276. }
  277. public function getComment(): ?string
  278. {
  279. return $this->comment;
  280. }
  281. public function setComment(?string $comment): self
  282. {
  283. $this->comment = $comment;
  284. return $this;
  285. }
  286. public function getPointSale(): ?PointSaleInterface
  287. {
  288. return $this->pointSale;
  289. }
  290. public function setPointSale(PointSaleInterface $pointSale): self
  291. {
  292. $this->pointSale = $pointSale;
  293. // set the owning side of the relation if necessary
  294. if ($pointSale->getAddress() !== $this) {
  295. $pointSale->setAddress($this);
  296. }
  297. return $this;
  298. }
  299. public function getMerchant(): ?MerchantInterface
  300. {
  301. return $this->merchant;
  302. }
  303. public function setMerchant(MerchantInterface $merchant): self
  304. {
  305. $this->merchant = $merchant;
  306. // set the owning side of the relation if necessary
  307. if ($merchant->getAddress() !== $this) {
  308. $merchant->setAddress($this);
  309. }
  310. return $this;
  311. }
  312. public function getDeliveryInfos(): ?string
  313. {
  314. return $this->deliveryInfos;
  315. }
  316. public function setDeliveryInfos(?string $deliveryInfos): self
  317. {
  318. $this->deliveryInfos = $deliveryInfos;
  319. return $this;
  320. }
  321. }