src/Entity/System/Address.php line 18

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\System;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity(repositoryClass="App\Repository\System\AddressRepository")
  7. *
  8. * @ORM\Table(name="ps_address", indexes={
  9. *
  10. * @ORM\Index(name="ps_address_iso_vat_number", columns={"iso_vat_number"}),
  11. * @ORM\Index(name="vat_number", columns={"vat_number"}),
  12. * })
  13. */
  14. class Address implements AddressInterface
  15. {
  16. /**
  17. * @var int
  18. *
  19. * @ORM\Id
  20. *
  21. * @ORM\GeneratedValue(strategy="AUTO")
  22. *
  23. * @ORM\Column(type="integer", name="id_address")
  24. */
  25. private $id;
  26. /**
  27. * @var Country
  28. *
  29. * @ORM\ManyToOne(targetEntity="App\Entity\System\Country", inversedBy="addresses")
  30. *
  31. * @ORM\JoinColumn(referencedColumnName="id_country", name="id_country", nullable=false)
  32. */
  33. private $country;
  34. /**
  35. * @var string|null
  36. *
  37. * @ORM\Column(type="string", length=32, nullable=true)
  38. */
  39. private $alias;
  40. /**
  41. * @var string|null
  42. *
  43. * @ORM\Column(type="string", length=64, nullable=true)
  44. */
  45. private $company;
  46. /**
  47. * @var string|null
  48. *
  49. * @ORM\Column(type="string", length=32, nullable=true)
  50. */
  51. private $name;
  52. /**
  53. * @var string
  54. *
  55. * @ORM\Column(type="string", length=128)
  56. */
  57. private $email;
  58. /**
  59. * @var string|null
  60. *
  61. * @ORM\Column(type="string", length=32, nullable=true)
  62. */
  63. private $surnames;
  64. /**
  65. * @var string
  66. *
  67. * @ORM\Column(type="string", length=128)
  68. */
  69. private $address1;
  70. /**
  71. * @var string|null
  72. *
  73. * @ORM\Column(type="string", length=128, nullable=true)
  74. */
  75. private $address2;
  76. /**
  77. * @var string|null
  78. *
  79. * @ORM\Column(type="string", length=12, nullable=true)
  80. */
  81. private $postcode;
  82. /**
  83. * @var string
  84. *
  85. * @ORM\Column(type="string", length=64)
  86. */
  87. private $city;
  88. /**
  89. * @var string|null
  90. *
  91. * @ORM\Column(type="text", name="other", nullable=true)
  92. */
  93. private $comments;
  94. /**
  95. * @var string|null
  96. *
  97. * @ORM\Column(type="string", length=32, nullable=true)
  98. */
  99. private $phone;
  100. /**
  101. * @var string|null
  102. *
  103. * @ORM\Column(type="string", length=32, nullable=true)
  104. */
  105. private $phoneMobile;
  106. /**
  107. * @var string|null
  108. *
  109. * @ORM\Column(type="string", length=32, nullable=true)
  110. */
  111. private $vatNumber;
  112. /**
  113. * @var \DateTime
  114. *
  115. * @ORM\Column(type="datetime")
  116. */
  117. private $dateAdd;
  118. /**
  119. * @var \DateTime
  120. *
  121. * @ORM\Column(type="datetime")
  122. */
  123. private $dateUpd;
  124. /**
  125. * @var string|null
  126. *
  127. * @ORM\Column(name="comercial_name", type="string", length=128, nullable=true)
  128. */
  129. private $commercialName;
  130. /**
  131. * @var string|null
  132. *
  133. * @ORM\Column(type="string", length=50, nullable=true, options={"default" : "1"})
  134. */
  135. private $contactName;
  136. /**
  137. * @var int
  138. *
  139. * @ORM\Column(type="integer", length=10, options={"default" : 0})
  140. */
  141. private $phonePrefix;
  142. /**
  143. * @var int
  144. *
  145. * @ORM\Column(type="integer", length=10, options={"default" : 0})
  146. */
  147. private $phoneMobilePrefix;
  148. /**
  149. * @var string|null
  150. *
  151. * @ORM\Column(type="string", length=64, nullable=true)
  152. */
  153. private $companyName;
  154. /**
  155. * @var string|null
  156. *
  157. * @ORM\Column(type="string", length=3, nullable=true)
  158. */
  159. private $isoVatNumber;
  160. /**
  161. * @var ?CustomerInvoiceAddress
  162. *
  163. * @ORM\OneToOne(targetEntity="App\Entity\System\CustomerInvoiceAddress", mappedBy="deliveryAddress")
  164. */
  165. private $customerInvoiceAddress;
  166. /**
  167. * @ORM\OneToOne(targetEntity="App\Entity\System\AddressEncrypted", cascade={"persist", "remove"})
  168. *
  169. * @ORM\JoinColumn(name="address_encrypted", referencedColumnName="id")
  170. */
  171. private ?AddressEncrypted $addressEncrypted = null;
  172. private ?string $plainEmail = null;
  173. private ?string $plainName = null;
  174. private ?string $plainSurnames = null;
  175. private ?string $plainPhone = null;
  176. private ?string $plainPhoneMobile = null;
  177. private ?string $plainAddress1 = null;
  178. private ?string $plainAddress2 = null;
  179. private ?string $plainPostcode = null;
  180. private ?string $plainCity = null;
  181. private ?string $plainVatNumber = null;
  182. public function __construct()
  183. {
  184. $this->dateUpd = new \DateTime();
  185. $this->address1 = '';
  186. $this->city = '';
  187. $this->contactName = '1';
  188. $this->phonePrefix = 0;
  189. $this->phoneMobilePrefix = 0;
  190. $this->dateAdd = new \DateTime();
  191. }
  192. public function getId(): int
  193. {
  194. return $this->id;
  195. }
  196. public function setId(int $id): Address
  197. {
  198. $this->id = $id;
  199. return $this;
  200. }
  201. public function getCountry(): Country
  202. {
  203. return $this->country;
  204. }
  205. public function setCountry(Country $country): Address
  206. {
  207. $this->country = $country;
  208. return $this;
  209. }
  210. public function getAlias(): ?string
  211. {
  212. return $this->alias;
  213. }
  214. public function setAlias(?string $alias): Address
  215. {
  216. $this->alias = $alias;
  217. return $this;
  218. }
  219. public function getCompany(): ?string
  220. {
  221. return $this->company;
  222. }
  223. public function setCompany(?string $company): Address
  224. {
  225. $this->company = $company;
  226. return $this;
  227. }
  228. public function getName(): ?string
  229. {
  230. return $this->name;
  231. }
  232. public function setName(?string $name): Address
  233. {
  234. $this->name = $name;
  235. return $this;
  236. }
  237. public function getEmail(): string
  238. {
  239. return $this->email;
  240. }
  241. public function setEmail(string $email): Address
  242. {
  243. $this->email = $email;
  244. return $this;
  245. }
  246. public function getSurnames(): ?string
  247. {
  248. return $this->surnames;
  249. }
  250. public function setSurnames(?string $surnames): Address
  251. {
  252. $this->surnames = $surnames;
  253. return $this;
  254. }
  255. public function getAddress1(): string
  256. {
  257. return $this->address1;
  258. }
  259. public function setAddress1(string $address1): Address
  260. {
  261. $this->address1 = $address1;
  262. return $this;
  263. }
  264. public function getAddress2(): ?string
  265. {
  266. return $this->address2;
  267. }
  268. public function setAddress2(?string $address2): Address
  269. {
  270. $this->address2 = $address2;
  271. return $this;
  272. }
  273. public function getPostcode(): ?string
  274. {
  275. return $this->postcode;
  276. }
  277. public function setPostcode(?string $postcode): Address
  278. {
  279. $this->postcode = $postcode;
  280. return $this;
  281. }
  282. public function getCity(): string
  283. {
  284. return $this->city;
  285. }
  286. public function setCity(string $city): Address
  287. {
  288. $this->city = $city;
  289. return $this;
  290. }
  291. public function getComments(): ?string
  292. {
  293. return $this->comments;
  294. }
  295. public function setComments(?string $comments): Address
  296. {
  297. $this->comments = $comments;
  298. return $this;
  299. }
  300. public function getPhone(): ?string
  301. {
  302. return $this->phone;
  303. }
  304. public function setPhone(?string $phone): Address
  305. {
  306. $this->phone = $phone;
  307. return $this;
  308. }
  309. /**
  310. * @return string|null
  311. */
  312. public function getPhoneMobile(): ?string
  313. {
  314. return $this->phoneMobile;
  315. }
  316. public function setPhoneMobile(?string $phoneMobile): Address
  317. {
  318. $this->phoneMobile = $phoneMobile;
  319. return $this;
  320. }
  321. public function getVatNumber(): ?string
  322. {
  323. return $this->vatNumber;
  324. }
  325. public function setVatNumber(?string $vatNumber): Address
  326. {
  327. if (!$vatNumber) {
  328. return $this;
  329. }
  330. $this->vatNumber = preg_replace('/[^A-Za-z0-9]/i', '', $vatNumber);
  331. return $this;
  332. }
  333. public function getDateAdd(): \DateTime
  334. {
  335. return $this->dateAdd;
  336. }
  337. public function setDateAdd(\DateTime $dateAdd): Address
  338. {
  339. $this->dateAdd = $dateAdd;
  340. return $this;
  341. }
  342. public function getDateUpd(): \DateTime
  343. {
  344. return $this->dateUpd;
  345. }
  346. public function setDateUpd(\DateTime $dateUpd): Address
  347. {
  348. $this->dateUpd = $dateUpd;
  349. return $this;
  350. }
  351. public function getCommercialName(): ?string
  352. {
  353. return $this->commercialName;
  354. }
  355. public function setCommercialName(?string $commercialName): Address
  356. {
  357. $this->commercialName = $commercialName;
  358. return $this;
  359. }
  360. public function getContactName(): ?string
  361. {
  362. return $this->contactName;
  363. }
  364. public function setContactName(?string $contactName): Address
  365. {
  366. $this->contactName = $contactName;
  367. return $this;
  368. }
  369. public function getPhonePrefix(): int
  370. {
  371. return $this->phonePrefix;
  372. }
  373. public function setPhonePrefix(int $phonePrefix): Address
  374. {
  375. $this->phonePrefix = $phonePrefix;
  376. return $this;
  377. }
  378. public function getPhoneMobilePrefix(): int
  379. {
  380. return $this->phoneMobilePrefix;
  381. }
  382. public function setPhoneMobilePrefix(int $phoneMobilePrefix): Address
  383. {
  384. $this->phoneMobilePrefix = $phoneMobilePrefix;
  385. return $this;
  386. }
  387. public function getCompanyName(): ?string
  388. {
  389. return $this->companyName;
  390. }
  391. public function setCompanyName(?string $companyName): Address
  392. {
  393. $this->companyName = $companyName;
  394. return $this;
  395. }
  396. /**
  397. * @return string|null
  398. */
  399. public function getIsoVatNumber(): ?string
  400. {
  401. return $this->isoVatNumber;
  402. }
  403. /**
  404. * @param string|null $isoVatNumber
  405. *
  406. * @return Address
  407. */
  408. public function setIsoVatNumber(?string $isoVatNumber): self
  409. {
  410. $this->isoVatNumber = $isoVatNumber;
  411. return $this;
  412. }
  413. public function setCustomerInvoiceAddress(CustomerInvoiceAddress $customerInvoiceAddress): self
  414. {
  415. $this->customerInvoiceAddress = $customerInvoiceAddress;
  416. return $this;
  417. }
  418. public function getCustomerInvoiceAddress(): ?CustomerInvoiceAddress
  419. {
  420. return $this->customerInvoiceAddress;
  421. }
  422. public function getAddressEncrypted(): ?AddressEncrypted
  423. {
  424. return $this->addressEncrypted;
  425. }
  426. public function setAddressEncrypted(?AddressEncrypted $addressEncrypted): Address
  427. {
  428. $this->addressEncrypted = $addressEncrypted;
  429. return $this;
  430. }
  431. public function getPlainEmail(): ?string
  432. {
  433. return $this->plainEmail;
  434. }
  435. public function setPlainEmail(?string $plainEmail): Address
  436. {
  437. $this->plainEmail = $plainEmail;
  438. return $this;
  439. }
  440. public function getPlainName(): ?string
  441. {
  442. return $this->plainName;
  443. }
  444. public function setPlainName(?string $plainName): Address
  445. {
  446. $this->plainName = $plainName;
  447. return $this;
  448. }
  449. public function getPlainSurnames(): ?string
  450. {
  451. return $this->plainSurnames;
  452. }
  453. public function setPlainSurnames(?string $plainSurnames): Address
  454. {
  455. $this->plainSurnames = $plainSurnames;
  456. return $this;
  457. }
  458. public function getPlainPhone(): ?string
  459. {
  460. return $this->plainPhone;
  461. }
  462. public function setPlainPhone(?string $plainPhone): Address
  463. {
  464. $this->plainPhone = $plainPhone;
  465. return $this;
  466. }
  467. public function getPlainPhoneMobile(): ?string
  468. {
  469. return $this->plainPhoneMobile;
  470. }
  471. public function setPlainPhoneMobile(?string $plainPhoneMobile): Address
  472. {
  473. $this->plainPhoneMobile = $plainPhoneMobile;
  474. return $this;
  475. }
  476. public function getPlainAddress1(): ?string
  477. {
  478. return $this->plainAddress1;
  479. }
  480. public function setPlainAddress1(?string $plainAddress1): Address
  481. {
  482. $this->plainAddress1 = $plainAddress1;
  483. return $this;
  484. }
  485. public function getPlainAddress2(): ?string
  486. {
  487. return $this->plainAddress2;
  488. }
  489. public function setPlainAddress2(?string $plainAddress2): Address
  490. {
  491. $this->plainAddress2 = $plainAddress2;
  492. return $this;
  493. }
  494. public function getPlainPostcode(): ?string
  495. {
  496. return $this->plainPostcode;
  497. }
  498. public function setPlainPostcode(?string $plainPostcode): Address
  499. {
  500. $this->plainPostcode = $plainPostcode;
  501. return $this;
  502. }
  503. public function getPlainCity(): ?string
  504. {
  505. return $this->plainCity;
  506. }
  507. public function setPlainCity(?string $plainCity): Address
  508. {
  509. $this->plainCity = $plainCity;
  510. return $this;
  511. }
  512. public function getPlainVatNumber(): ?string
  513. {
  514. return $this->plainVatNumber;
  515. }
  516. public function setPlainVatNumber(?string $plainVatNumber): Address
  517. {
  518. $this->plainVatNumber = $plainVatNumber;
  519. return $this;
  520. }
  521. }