src/Entity/System/Language.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Table(
  7. * name="ps_lang",
  8. * indexes={
  9. *
  10. * @ORM\Index(name="lang_iso_code", columns={"iso_code"}),
  11. * @ORM\Index(name="active", columns={"active"})
  12. * }
  13. * )
  14. *
  15. * @ORM\Entity(repositoryClass="App\Repository\System\LanguageRepository")
  16. */
  17. class Language
  18. {
  19. public const SPANISH_LANGUAGE_ID = 4;
  20. public const ENGLISH_LANGUAGE_ID = 1;
  21. public const FRENCH_LANGUAGE_ID = 5;
  22. public const DEUTSCH_LANGUAGE_ID = 6;
  23. public const ITALY_LANGUAGE_ID = 10;
  24. public const ENGLISH_ISO = 'en';
  25. public const SPANISH_ISO = 'es';
  26. public const FRENCH_ISO = 'fr';
  27. public const ITALIAN_ISO = 'it';
  28. public const GERMAN_ISO = 'de';
  29. public const BULGARIAN_ISO = 'bg';
  30. public const CZECH_ISO = 'cs';
  31. public const DANISH_ISO = 'da';
  32. public const GREEK_ISO = 'el';
  33. public const ESTONIAN_ISO = 'et';
  34. public const FINNISH_ISO = 'fi';
  35. public const CROATIAN_ISO = 'hr';
  36. public const HUNGARIAN_ISO = 'hu';
  37. public const LITHUANIAN_ISO = 'lt';
  38. public const LATVIAN_ISO = 'lv';
  39. public const DUTCH_ISO = 'nl';
  40. public const POLISH_ISO = 'pl';
  41. public const PORTUGUESE_ISO = 'pt';
  42. public const ROMANIAN_ISO = 'ro';
  43. public const RUSSIAN_ISO = 'ru';
  44. public const SLOVAK_ISO = 'sk';
  45. public const SLOVENIAN_ISO = 'si';
  46. public const SWEDISH_ISO = 'sv';
  47. public const EMAIL_ENABLED_LANGUAGES = [self::ENGLISH_ISO, self::SPANISH_ISO, self::FRENCH_ISO, self::ITALIAN_ISO, self::GERMAN_ISO];
  48. public const ENGLISH_NAME = 'English';
  49. public const LANGUAGE_IDS_INDEXED_BY_ISO_CODE = [
  50. 'en' => 1,
  51. 'es' => 4,
  52. 'fr' => 5,
  53. 'de' => 6,
  54. 'pt' => 7,
  55. 'el' => 8,
  56. 'hr' => 9,
  57. 'it' => 10,
  58. 'et' => 11,
  59. 'da' => 12,
  60. 'fi' => 13,
  61. 'ro' => 14,
  62. 'bg' => 15,
  63. 'hu' => 16,
  64. 'sk' => 18,
  65. 'si' => 19,
  66. 'lt' => 20,
  67. 'lv' => 21,
  68. 'pl' => 22,
  69. 'nl' => 24,
  70. 'ru' => 25,
  71. 'no' => 26,
  72. 'sv' => 27,
  73. 'cs' => 28,
  74. ];
  75. /**
  76. * @ORM\Id()
  77. *
  78. * @ORM\GeneratedValue(strategy="AUTO")
  79. *
  80. * @ORM\Column(name="id_lang", type="integer", options={"unsigned":true})
  81. */
  82. private $id;
  83. /**
  84. * @ORM\Column(type="string", length=32)
  85. */
  86. private $name;
  87. /**
  88. * @ORM\Column(type="boolean", options={"unsigned":true, "default":0})
  89. */
  90. private $active;
  91. /**
  92. * @ORM\Column(type="string", length=2)
  93. */
  94. private $isoCode;
  95. /**
  96. * @ORM\Column(type="string", length=5)
  97. */
  98. private $languageCode;
  99. /**
  100. * @ORM\Column(type="string", length=32, options={"default":"Y-m-d"})
  101. */
  102. private $dateFormatLite;
  103. /**
  104. * @ORM\Column(type="string", length=32, options={"default":"Y-m-d H:i:s"})
  105. */
  106. private $dateFormatFull;
  107. /**
  108. * @ORM\Column(type="string", length=32)
  109. */
  110. private $dictionary;
  111. /**
  112. * @ORM\Column(type="integer", nullable=false, options={"default":1})
  113. */
  114. private $currencyFormat;
  115. /**
  116. * @ORM\Column(type="string", length=2, nullable=true)
  117. */
  118. private $isoCodeReal;
  119. /**
  120. * @ORM\Column(type="string", length=32, nullable=true)
  121. */
  122. private string $nameEnglish;
  123. /**
  124. * @ORM\OneToMany(targetEntity="App\Entity\System\CountryLanguage", mappedBy="language")
  125. */
  126. private $countryLanguages;
  127. /**
  128. * @ORM\OneToMany(targetEntity="App\Entity\System\PackLanguage", mappedBy="language")
  129. */
  130. private $packs;
  131. /**
  132. * @ORM\OneToMany(targetEntity="App\Entity\System\Answer", mappedBy="language")
  133. */
  134. private $answers;
  135. /**
  136. * @ORM\OneToMany(targetEntity="Question", mappedBy="language")
  137. */
  138. private $questions;
  139. public function __construct()
  140. {
  141. $this->packs = new ArrayCollection();
  142. $this->countryLanguages = new ArrayCollection();
  143. $this->questions = new ArrayCollection();
  144. $this->answers = new ArrayCollection();
  145. }
  146. public function getId(): ?int
  147. {
  148. return $this->id;
  149. }
  150. public function setId(int $id): self
  151. {
  152. $this->id = $id;
  153. return $this;
  154. }
  155. public function getName(): ?string
  156. {
  157. return $this->name;
  158. }
  159. /**
  160. * @return $this
  161. */
  162. public function setName(string $name): self
  163. {
  164. $this->name = $name;
  165. return $this;
  166. }
  167. public function getActive(): ?bool
  168. {
  169. return $this->active;
  170. }
  171. /**
  172. * @return $this
  173. */
  174. public function setActive(bool $active): self
  175. {
  176. $this->active = $active;
  177. return $this;
  178. }
  179. public function getIsoCode(): ?string
  180. {
  181. return $this->isoCode;
  182. }
  183. /**
  184. * @return $this
  185. */
  186. public function setIsoCode(string $isoCode): self
  187. {
  188. $this->isoCode = $isoCode;
  189. return $this;
  190. }
  191. public function getLanguageCode(): ?string
  192. {
  193. return $this->languageCode;
  194. }
  195. /**
  196. * @return $this
  197. */
  198. public function setLanguageCode(string $languageCode): self
  199. {
  200. $this->languageCode = $languageCode;
  201. return $this;
  202. }
  203. public function getDateFormatLite(): string
  204. {
  205. return $this->dateFormatLite;
  206. }
  207. /**
  208. * @return $this
  209. */
  210. public function setDateFormatLite(string $dateFormatLite): self
  211. {
  212. $this->dateFormatLite = $dateFormatLite;
  213. return $this;
  214. }
  215. public function getDateFormatFull(): string
  216. {
  217. return $this->dateFormatFull;
  218. }
  219. /**
  220. * @return $this
  221. */
  222. public function setDateFormatFull(string $dateFormatFull): self
  223. {
  224. $this->dateFormatFull = $dateFormatFull;
  225. return $this;
  226. }
  227. public function getDictionary(): ?string
  228. {
  229. return $this->dictionary;
  230. }
  231. /**
  232. * @return $this
  233. */
  234. public function setDictionary(string $dictionary): self
  235. {
  236. $this->dictionary = $dictionary;
  237. return $this;
  238. }
  239. public function getCurrencyFormat(): ?int
  240. {
  241. return $this->currencyFormat;
  242. }
  243. /**
  244. * @return $this
  245. */
  246. public function setCurrencyFormat(int $currencyFormat): self
  247. {
  248. $this->currencyFormat = $currencyFormat;
  249. return $this;
  250. }
  251. public function getIsoCodeReal(): ?string
  252. {
  253. return $this->isoCodeReal;
  254. }
  255. /**
  256. * @return $this
  257. */
  258. public function setIsoCodeReal(?string $isoCodeReal): self
  259. {
  260. $this->isoCodeReal = $isoCodeReal;
  261. return $this;
  262. }
  263. /**
  264. * @return mixed
  265. */
  266. public function getNameEnglish()
  267. {
  268. return $this->nameEnglish;
  269. }
  270. /**
  271. * @param mixed $nameEnglish
  272. */
  273. public function setNameEnglish($nameEnglish): void
  274. {
  275. $this->nameEnglish = $nameEnglish;
  276. }
  277. /**
  278. * @return ArrayCollection<int, CountryLanguage>|CountryLanguage[]
  279. */
  280. public function getCountryLanguages()
  281. {
  282. return $this->countryLanguages;
  283. }
  284. /**
  285. * @param ArrayCollection<int, CountryLanguage>|CountryLanguage[] $countryLanguages
  286. */
  287. public function setCountryLanguages($countryLanguages): self
  288. {
  289. $this->countryLanguages = $countryLanguages;
  290. return $this;
  291. }
  292. /**
  293. * @return ArrayCollection<int, PackLanguage>|PackLanguage[]
  294. */
  295. public function getPacks()
  296. {
  297. return $this->packs;
  298. }
  299. /**
  300. * @param ArrayCollection<int, PackLanguage>|PackLanguage[] $packs
  301. */
  302. public function setPacks($packs): self
  303. {
  304. $this->packs = $packs;
  305. return $this;
  306. }
  307. /**
  308. * @return ArrayCollection<int, Answer>
  309. */
  310. public function getAnswers()
  311. {
  312. return $this->answers;
  313. }
  314. /**
  315. * @param Answer[]|ArrayCollection<int, Answer> $answers
  316. */
  317. public function setAnswers($answers): self
  318. {
  319. $this->answers = $answers;
  320. return $this;
  321. }
  322. /**
  323. * @return ArrayCollection<int, Question>|Question[]
  324. */
  325. public function getQuestions()
  326. {
  327. return $this->questions;
  328. }
  329. /**
  330. * @param ArrayCollection<int, Question>|Question[] $questions
  331. */
  332. public function setQuestions($questions): self
  333. {
  334. $this->questions = $questions;
  335. return $this;
  336. }
  337. public function __toString(): string
  338. {
  339. return ''.$this->getName();
  340. }
  341. }