src/Entity/Country.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * Countries
  6. *
  7. * @ORM\Table(name="countries", indexes={@ORM\Index(name="IDX_COUNTRIES_NAME", columns={"countries_name"})})
  8. * @ORM\Entity
  9. */
  10. class Country
  11. {
  12. /**
  13. * @var int
  14. *
  15. * @ORM\Column(name="countries_id", type="integer", nullable=false)
  16. * @ORM\Id
  17. * @ORM\GeneratedValue(strategy="IDENTITY")
  18. */
  19. private $id;
  20. /**
  21. * @var string
  22. *
  23. * @ORM\Column(name="countries_name", type="string", length=64, nullable=false)
  24. */
  25. private $name = '';
  26. /**
  27. * @var string
  28. *
  29. * @ORM\Column(name="countries_iso_code_2", type="string", length=2, nullable=false, options={"fixed"=true})
  30. */
  31. private $isoCode2 = '';
  32. /**
  33. * @var string
  34. *
  35. * @ORM\Column(name="countries_iso_code_3", type="string", length=3, nullable=false, options={"fixed"=true})
  36. */
  37. private $isoCode3 = '';
  38. /**
  39. * @var int
  40. *
  41. * @ORM\Column(name="address_format_id", type="integer", nullable=false)
  42. */
  43. private $addressFormatId = '0';
  44. /**
  45. * @var string
  46. *
  47. * @ORM\Column(name="countries_distri_name", type="string", length=64, nullable=false)
  48. */
  49. private $distriName;
  50. /**
  51. * @var string
  52. *
  53. * @ORM\Column(name="countries_adresse", type="string", length=128, nullable=false)
  54. */
  55. private $address;
  56. /**
  57. * @var string
  58. *
  59. * @ORM\Column(name="countries_website", type="string", length=128, nullable=false)
  60. */
  61. private $website;
  62. /**
  63. * @var string
  64. *
  65. * @ORM\Column(name="countries_url", type="string", length=124, nullable=false)
  66. */
  67. private $url;
  68. /**
  69. * @var string
  70. *
  71. * @ORM\Column(name="countries_tel", type="string", length=64, nullable=false)
  72. */
  73. private $tel;
  74. /**
  75. * @var string
  76. *
  77. * @ORM\Column(name="countries_logo", type="string", length=128, nullable=false)
  78. */
  79. private $logo;
  80. /**
  81. * @var int
  82. *
  83. * @ORM\Column(name="countries_blocage", type="integer", nullable=false)
  84. */
  85. private $blocage = '0';
  86. /**
  87. * @var string
  88. *
  89. * @ORM\Column(name="countries_commercial", type="string", length=128, nullable=false)
  90. */
  91. private $commercial;
  92. /**
  93. * @var string
  94. *
  95. * @ORM\Column(name="countries_texte_prix01", type="string", length=128, nullable=false)
  96. */
  97. private $textePrix01;
  98. /**
  99. * @var string
  100. *
  101. * @ORM\Column(name="countries_texte_prix02", type="string", length=128, nullable=false)
  102. */
  103. private $textePrix02;
  104. /**
  105. * @var string
  106. *
  107. * @ORM\Column(name="countries_texte_email01", type="string", length=512, nullable=false)
  108. */
  109. private $texteEmail01;
  110. /**
  111. * @var string
  112. *
  113. * @ORM\Column(name="countries_email", type="string", length=128, nullable=false)
  114. */
  115. private $email;
  116. /**
  117. * @var int
  118. *
  119. * @ORM\Column(name="countries_soleil", type="integer", nullable=false, options={"default"="1"})
  120. */
  121. private $soleil = '1';
  122. /**
  123. * @var int
  124. *
  125. * @ORM\Column(name="countries_bienvenue", type="integer", nullable=false, options={"default"="1"})
  126. */
  127. private $bienvenue = '1';
  128. /**
  129. * @var ?int
  130. *
  131. * @ORM\Column(name="countries_rank", type="integer", nullable=true)
  132. */
  133. private $rank = '1';
  134. public function getId() {
  135. return $this->id;
  136. }
  137. public function getName() {
  138. return $this->name;
  139. }
  140. public function getIsoCode2() {
  141. return $this->isoCode2;
  142. }
  143. public function getIsoCode3() {
  144. return $this->isoCode3;
  145. }
  146. public function getAddressFormatId() {
  147. return $this->addressFormatId;
  148. }
  149. public function getDistriName() {
  150. return $this->distriName;
  151. }
  152. public function getAddress() {
  153. return $this->address;
  154. }
  155. public function getWebsite() {
  156. return $this->website;
  157. }
  158. public function getUrl() {
  159. return $this->url;
  160. }
  161. public function getTel() {
  162. return $this->tel;
  163. }
  164. public function getLogo() {
  165. return $this->logo;
  166. }
  167. public function getBlocage() {
  168. return $this->blocage;
  169. }
  170. public function getCommercial() {
  171. return $this->commercial;
  172. }
  173. public function getTextePrix01() {
  174. return $this->textePrix01;
  175. }
  176. public function getTextePrix02() {
  177. return $this->textePrix02;
  178. }
  179. public function getTexteEmail01() {
  180. return $this->texteEmail01;
  181. }
  182. public function getEmail() {
  183. return $this->email;
  184. }
  185. public function getSoleil() {
  186. return $this->soleil;
  187. }
  188. public function getBienvenue() {
  189. return $this->bienvenue;
  190. }
  191. public function getRank() {
  192. return $this->rank;
  193. }
  194. public function setName($name) {
  195. $this->name = $name;
  196. }
  197. public function setIsoCode2($isoCode2) {
  198. $this->isoCode2 = $isoCode2;
  199. }
  200. public function setIsoCode3($isoCode3) {
  201. $this->isoCode3 = $isoCode3;
  202. }
  203. public function setAddressFormatId($addressFormatId) {
  204. $this->addressFormatId = $addressFormatId;
  205. }
  206. public function setDistriName($distriName) {
  207. $this->distriName = $distriName;
  208. }
  209. public function setAddress($address) {
  210. $this->address = $address;
  211. }
  212. public function setWebsite($website) {
  213. $this->website = $website;
  214. }
  215. public function setUrl($url) {
  216. $this->url = $url;
  217. }
  218. public function setTel($tel) {
  219. $this->tel = $tel;
  220. }
  221. public function setLogo($logo) {
  222. $this->logo = $logo;
  223. }
  224. public function setBlocage($blocage) {
  225. $this->blocage = $blocage;
  226. }
  227. public function setCommercial($commercial) {
  228. $this->commercial = $commercial;
  229. }
  230. public function setTextePrix01($textePrix01) {
  231. $this->textePrix01 = $textePrix01;
  232. }
  233. public function setTextePrix02($textePrix02) {
  234. $this->textePrix02 = $textePrix02;
  235. }
  236. public function setTexteEmail01($texteEmail01) {
  237. $this->texteEmail01 = $texteEmail01;
  238. }
  239. public function setEmail($email) {
  240. $this->email = $email;
  241. }
  242. public function setSoleil($soleil) {
  243. $this->soleil = $soleil;
  244. }
  245. public function setBienvenue($bienvenue) {
  246. $this->bienvenue = $bienvenue;
  247. }
  248. public function setRank(int $rank) {
  249. $this->rank = $rank;
  250. }
  251. public function isDom() {
  252. // 75 France - Guyane (DOM)
  253. // 174 France - Réunion (DOM)
  254. // 240 France - Guadeloupe (DOM)
  255. // 241 France - Martinique (DOM)
  256. return in_array($this->getId(), [75, 174, 240, 241]);
  257. }
  258. public function isFrance() {
  259. return $this->isoCode3 == 'FRA';
  260. }
  261. public function toArray() : array{
  262. $output = [
  263. 'id' => $this->getId(),
  264. 'name' => $this->getName(),
  265. 'isoCode2' => $this->getIsoCode2(),
  266. 'isoCode3' => $this->getIsoCode3(),
  267. 'addressFormatId' => $this->getAddressFormatId(),
  268. 'distriName' => $this->getDistriName(),
  269. 'address' => $this->getAddress(),
  270. 'website' => $this->getUrl(),
  271. 'url' => $this->getUrl(),
  272. 'tel' => $this->getTel(),
  273. 'logo' => $this->getLogo(),
  274. 'blocage' => $this->getBlocage(),
  275. 'commercial' => $this->getCommercial(),
  276. 'email' => $this->getEmail(),
  277. 'soleil' => $this->getSoleil(),
  278. 'bienvenue' => $this->getBienvenue()
  279. ];
  280. return $output;
  281. }
  282. public function __toString() {
  283. return $this->getName();
  284. }
  285. }