src/Entity/System/Address.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * @ORM\Entity(repositoryClass="App\Repository\System\AddressRepository")
  6. *
  7. * @ORM\Table(name="ps_address", indexes={
  8. *
  9. * @ORM\Index(name="ps_address_iso_vat_number", columns={"iso_vat_number"}),
  10. * @ORM\Index(name="vat_number", columns={"vat_number"}),
  11. * })
  12. */
  13. class Address implements AddressInterface
  14. {
  15. /**
  16. * @var int
  17. *
  18. * @ORM\Id
  19. *
  20. * @ORM\GeneratedValue(strategy="AUTO")
  21. *
  22. * @ORM\Column(type="integer", name="id_address")
  23. */
  24. private $id;
  25. /**
  26. * @var Country
  27. *
  28. * @ORM\ManyToOne(targetEntity="App\Entity\System\Country", inversedBy="addresses")
  29. *
  30. * @ORM\JoinColumn(referencedColumnName="id_country", name="id_country", nullable=false)
  31. */
  32. private $country;
  33. /**
  34. * @var string|null
  35. *
  36. * @ORM\Column(type="string", length=32, nullable=true)
  37. */
  38. private $alias;
  39. /**
  40. * @var string|null
  41. *
  42. * @ORM\Column(type="string", length=64, nullable=true)
  43. */
  44. private $company;
  45. /**
  46. * @var string|null
  47. *
  48. * @ORM\Column(type="string", length=32, nullable=true)
  49. */
  50. private $name;
  51. /**
  52. * @var string
  53. *
  54. * @ORM\Column(type="string", length=128)
  55. */
  56. private $email;
  57. /**
  58. * @var string|null
  59. *
  60. * @ORM\Column(type="string", length=32, nullable=true)
  61. */
  62. private $surnames;
  63. /**
  64. * @var string
  65. *
  66. * @ORM\Column(type="string", length=128)
  67. */
  68. private $address1;
  69. /**
  70. * @var string|null
  71. *
  72. * @ORM\Column(type="string", length=128, nullable=true)
  73. */
  74. private $address2;
  75. /**
  76. * @var string|null
  77. *
  78. * @ORM\Column(type="string", length=12, nullable=true)
  79. */
  80. private $postcode;
  81. /**
  82. * @var string
  83. *
  84. * @ORM\Column(type="string", length=64)
  85. */
  86. private $city;
  87. /**
  88. * @var string|null
  89. *
  90. * @ORM\Column(type="text", name="other", nullable=true)
  91. */
  92. private $comments;
  93. /**
  94. * @var string|null
  95. *
  96. * @ORM\Column(type="string", length=32, nullable=true)
  97. */
  98. private $phone;
  99. /**
  100. * @var string|null
  101. *
  102. * @ORM\Column(type="string", length=32, nullable=true)
  103. */
  104. private $phoneMobile;
  105. /**
  106. * @var string|null
  107. *
  108. * @ORM\Column(type="string", length=32, nullable=true)
  109. */
  110. private $vatNumber;
  111. /**
  112. * @var \DateTime
  113. *
  114. * @ORM\Column(type="datetime")
  115. */
  116. private $dateAdd;
  117. /**
  118. * @var \DateTime
  119. *
  120. * @ORM\Column(type="datetime")
  121. */
  122. private $dateUpd;
  123. /**
  124. * @var string|null
  125. *
  126. * @ORM\Column(type="string", length=128, nullable=true)
  127. */
  128. private $comercialName;
  129. /**
  130. * @var string|null
  131. *
  132. * @ORM\Column(type="string", length=50, nullable=true, options={"default" : "1"})
  133. */
  134. private $contactName;
  135. /**
  136. * @var int
  137. *
  138. * @ORM\Column(type="integer", length=10, options={"default" : 0})
  139. */
  140. private $phonePrefix;
  141. /**
  142. * @var int
  143. *
  144. * @ORM\Column(type="integer", length=10, options={"default" : 0})
  145. */
  146. private $phoneMobilePrefix;
  147. /**
  148. * @var string|null
  149. *
  150. * @ORM\Column(type="string", length=64, nullable=true)
  151. */
  152. private $companyName;
  153. /**
  154. * @var string|null
  155. *
  156. * @ORM\Column(type="string", length=3, nullable=true)
  157. */
  158. private $isoVatNumber;
  159. /**
  160. * @var ?CustomerInvoiceAddress
  161. *
  162. * @ORM\OneToOne(targetEntity="App\Entity\System\CustomerInvoiceAddress", mappedBy="deliveryAddress")
  163. */
  164. private $customerInvoiceAddress;
  165. public function __construct()
  166. {
  167. $this->dateUpd = new \DateTime();
  168. $this->address1 = '';
  169. $this->city = '';
  170. $this->contactName = '1';
  171. $this->phonePrefix = 0;
  172. $this->phoneMobilePrefix = 0;
  173. $this->dateAdd = new \DateTime();
  174. }
  175. public function getId(): int
  176. {
  177. return $this->id;
  178. }
  179. public function setId(int $id): Address
  180. {
  181. $this->id = $id;
  182. return $this;
  183. }
  184. public function getCountry(): Country
  185. {
  186. return $this->country;
  187. }
  188. public function setCountry(Country $country): Address
  189. {
  190. $this->country = $country;
  191. return $this;
  192. }
  193. public function getAlias(): ?string
  194. {
  195. return $this->alias;
  196. }
  197. public function setAlias(?string $alias): Address
  198. {
  199. $this->alias = $alias;
  200. return $this;
  201. }
  202. public function getCompany(): ?string
  203. {
  204. return $this->company;
  205. }
  206. public function setCompany(?string $company): Address
  207. {
  208. $this->company = $company;
  209. return $this;
  210. }
  211. public function getName(): ?string
  212. {
  213. return $this->name;
  214. }
  215. public function setName(?string $name): Address
  216. {
  217. $this->name = $name;
  218. return $this;
  219. }
  220. public function getEmail(): string
  221. {
  222. return $this->email;
  223. }
  224. public function setEmail(string $email): Address
  225. {
  226. $this->email = $email;
  227. return $this;
  228. }
  229. public function getSurnames(): ?string
  230. {
  231. return $this->surnames;
  232. }
  233. public function setSurnames(?string $surnames): Address
  234. {
  235. $this->surnames = $surnames;
  236. return $this;
  237. }
  238. public function getAddress1(): string
  239. {
  240. return $this->address1;
  241. }
  242. public function setAddress1(string $address1): Address
  243. {
  244. $this->address1 = $address1;
  245. return $this;
  246. }
  247. public function getAddress2(): ?string
  248. {
  249. return $this->address2;
  250. }
  251. public function setAddress2(?string $address2): Address
  252. {
  253. $this->address2 = $address2;
  254. return $this;
  255. }
  256. public function getPostcode(): ?string
  257. {
  258. return $this->postcode;
  259. }
  260. public function setPostcode(?string $postcode): Address
  261. {
  262. $this->postcode = $postcode;
  263. return $this;
  264. }
  265. public function getCity(): string
  266. {
  267. return $this->city;
  268. }
  269. public function setCity(string $city): Address
  270. {
  271. $this->city = $city;
  272. return $this;
  273. }
  274. public function getComments(): ?string
  275. {
  276. return $this->comments;
  277. }
  278. public function setComments(?string $comments): Address
  279. {
  280. $this->comments = $comments;
  281. return $this;
  282. }
  283. public function getPhone(): ?string
  284. {
  285. return $this->phone;
  286. }
  287. public function setPhone(?string $phone): Address
  288. {
  289. $this->phone = $phone;
  290. return $this;
  291. }
  292. /**
  293. * @return string|null
  294. */
  295. public function getPhoneMobile(): ?string
  296. {
  297. return $this->phoneMobile;
  298. }
  299. public function setPhoneMobile(?string $phoneMobile): Address
  300. {
  301. $this->phoneMobile = $phoneMobile;
  302. return $this;
  303. }
  304. public function getVatNumber(): ?string
  305. {
  306. return $this->vatNumber;
  307. }
  308. public function setVatNumber(?string $vatNumber): Address
  309. {
  310. if (!$vatNumber) {
  311. return $this;
  312. }
  313. $this->vatNumber = preg_replace('/[^A-Za-z0-9]/i', '', $vatNumber);
  314. return $this;
  315. }
  316. public function getDateAdd(): \DateTime
  317. {
  318. return $this->dateAdd;
  319. }
  320. public function setDateAdd(\DateTime $dateAdd): Address
  321. {
  322. $this->dateAdd = $dateAdd;
  323. return $this;
  324. }
  325. public function getDateUpd(): \DateTime
  326. {
  327. return $this->dateUpd;
  328. }
  329. public function setDateUpd(\DateTime $dateUpd): Address
  330. {
  331. $this->dateUpd = $dateUpd;
  332. return $this;
  333. }
  334. public function getComercialName(): ?string
  335. {
  336. return $this->comercialName;
  337. }
  338. public function setComercialName(?string $comercialName): Address
  339. {
  340. $this->comercialName = $comercialName;
  341. return $this;
  342. }
  343. public function getContactName(): ?string
  344. {
  345. return $this->contactName;
  346. }
  347. public function setContactName(?string $contactName): Address
  348. {
  349. $this->contactName = $contactName;
  350. return $this;
  351. }
  352. public function getPhonePrefix(): int
  353. {
  354. return $this->phonePrefix;
  355. }
  356. public function setPhonePrefix(int $phonePrefix): Address
  357. {
  358. $this->phonePrefix = $phonePrefix;
  359. return $this;
  360. }
  361. public function getPhoneMobilePrefix(): int
  362. {
  363. return $this->phoneMobilePrefix;
  364. }
  365. public function setPhoneMobilePrefix(int $phoneMobilePrefix): Address
  366. {
  367. $this->phoneMobilePrefix = $phoneMobilePrefix;
  368. return $this;
  369. }
  370. public function getCompanyName(): ?string
  371. {
  372. return $this->companyName;
  373. }
  374. public function setCompanyName(?string $companyName): Address
  375. {
  376. $this->companyName = $companyName;
  377. return $this;
  378. }
  379. /**
  380. * @return string|null
  381. */
  382. public function getIsoVatNumber(): ?string
  383. {
  384. return $this->isoVatNumber;
  385. }
  386. /**
  387. * @param string|null $isoVatNumber
  388. *
  389. * @return Address
  390. */
  391. public function setIsoVatNumber(?string $isoVatNumber): self
  392. {
  393. $this->isoVatNumber = $isoVatNumber;
  394. return $this;
  395. }
  396. public function getFullName(): ?string
  397. {
  398. return $this->name.' '.$this->surnames;
  399. }
  400. public function setCustomerInvoiceAddress(CustomerInvoiceAddress $customerInvoiceAddress): self
  401. {
  402. $this->customerInvoiceAddress = $customerInvoiceAddress;
  403. return $this;
  404. }
  405. public function getCustomerInvoiceAddress(): ?CustomerInvoiceAddress
  406. {
  407. return $this->customerInvoiceAddress;
  408. }
  409. }