Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

351 line
7.9KB

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