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 int $id;
  83. /**
  84. * @ORM\Column(type="string", length=32, nullable=false)
  85. */
  86. private string $name;
  87. /**
  88. * @ORM\Column(type="boolean", options={"unsigned":true, "default":0}, nullable=false)
  89. */
  90. private bool $active;
  91. /**
  92. * @ORM\Column(type="string", length=2, nullable=false)
  93. */
  94. private string $isoCode;
  95. /**
  96. * @ORM\Column(type="string", length=5, nullable=false)
  97. */
  98. private string $languageCode;
  99. /**
  100. * @ORM\Column(type="string", length=32, options={"default":"Y-m-d"}, nullable=false)
  101. */
  102. private string $dateFormatLite;
  103. /**
  104. * @ORM\Column(type="string", length=32, options={"default":"Y-m-d H:i:s"}, nullable=false)
  105. */
  106. private string $dateFormatFull;
  107. /**
  108. * @ORM\Column(type="string", length=32, nullable=true)
  109. */
  110. private ?string $dictionary;
  111. /**
  112. * @ORM\Column(type="integer", nullable=false, options={"default":1})
  113. */
  114. private int $currencyFormat;
  115. /**
  116. * @ORM\Column(type="string", length=2, nullable=true)
  117. */
  118. private ?string $isoCodeReal;
  119. /**
  120. * @ORM\Column(type="string", length=32, nullable=false)
  121. */
  122. private string $nameEnglish;
  123. /**
  124. * @var ArrayCollection<int, CountryLanguage>&iterable<CountryLanguage>
  125. *
  126. * @ORM\OneToMany(targetEntity="App\Entity\System\CountryLanguage", mappedBy="language")
  127. */
  128. private $countryLanguages;
  129. /**
  130. * @var ArrayCollection<int, PackLanguage>&iterable<PackLanguage>
  131. *
  132. * @ORM\OneToMany(targetEntity="App\Entity\System\PackLanguage", mappedBy="language")
  133. */
  134. private $packs;
  135. /**
  136. * @var ArrayCollection<int, Answer>&iterable<Answer>
  137. *
  138. * @ORM\OneToMany(targetEntity="App\Entity\System\Answer", mappedBy="language")
  139. */
  140. private $answers;
  141. /**
  142. * @var ArrayCollection<int, Question>&iterable<Question>
  143. *
  144. * @ORM\OneToMany(targetEntity="Question", mappedBy="language")
  145. */
  146. private $questions;
  147. public function __construct()
  148. {
  149. $this->packs = new ArrayCollection();
  150. $this->countryLanguages = new ArrayCollection();
  151. $this->questions = new ArrayCollection();
  152. $this->answers = new ArrayCollection();
  153. }
  154. public function getId(): ?int
  155. {
  156. return $this->id;
  157. }
  158. public function setId(int $id): self
  159. {
  160. $this->id = $id;
  161. return $this;
  162. }
  163. public function getName(): string
  164. {
  165. return $this->name;
  166. }
  167. /**
  168. * @return $this
  169. */
  170. public function setName(string $name): self
  171. {
  172. $this->name = $name;
  173. return $this;
  174. }
  175. public function getActive(): bool
  176. {
  177. return $this->active;
  178. }
  179. /**
  180. * @return $this
  181. */
  182. public function setActive(bool $active): self
  183. {
  184. $this->active = $active;
  185. return $this;
  186. }
  187. public function getIsoCode(): string
  188. {
  189. return $this->isoCode;
  190. }
  191. /**
  192. * @return $this
  193. */
  194. public function setIsoCode(string $isoCode): self
  195. {
  196. $this->isoCode = $isoCode;
  197. return $this;
  198. }
  199. public function getLanguageCode(): string
  200. {
  201. return $this->languageCode;
  202. }
  203. /**
  204. * @return $this
  205. */
  206. public function setLanguageCode(string $languageCode): self
  207. {
  208. $this->languageCode = $languageCode;
  209. return $this;
  210. }
  211. public function getDateFormatLite(): string
  212. {
  213. return $this->dateFormatLite;
  214. }
  215. /**
  216. * @return $this
  217. */
  218. public function setDateFormatLite(string $dateFormatLite): self
  219. {
  220. $this->dateFormatLite = $dateFormatLite;
  221. return $this;
  222. }
  223. public function getDateFormatFull(): string
  224. {
  225. return $this->dateFormatFull;
  226. }
  227. /**
  228. * @return $this
  229. */
  230. public function setDateFormatFull(string $dateFormatFull): self
  231. {
  232. $this->dateFormatFull = $dateFormatFull;
  233. return $this;
  234. }
  235. public function getDictionary(): ?string
  236. {
  237. return $this->dictionary;
  238. }
  239. /**
  240. * @return $this
  241. */
  242. public function setDictionary(string $dictionary): self
  243. {
  244. $this->dictionary = $dictionary;
  245. return $this;
  246. }
  247. public function getCurrencyFormat(): int
  248. {
  249. return $this->currencyFormat;
  250. }
  251. /**
  252. * @return $this
  253. */
  254. public function setCurrencyFormat(int $currencyFormat): self
  255. {
  256. $this->currencyFormat = $currencyFormat;
  257. return $this;
  258. }
  259. public function getIsoCodeReal(): ?string
  260. {
  261. return $this->isoCodeReal;
  262. }
  263. /**
  264. * @return $this
  265. */
  266. public function setIsoCodeReal(?string $isoCodeReal): self
  267. {
  268. $this->isoCodeReal = $isoCodeReal;
  269. return $this;
  270. }
  271. public function getNameEnglish(): string
  272. {
  273. return $this->nameEnglish;
  274. }
  275. public function setNameEnglish(string $nameEnglish): void
  276. {
  277. $this->nameEnglish = $nameEnglish;
  278. }
  279. /**
  280. * @return ArrayCollection<int, CountryLanguage>&iterable<CountryLanguage>
  281. */
  282. public function getCountryLanguages()
  283. {
  284. return $this->countryLanguages;
  285. }
  286. /**
  287. * @param ArrayCollection<int, CountryLanguage>&iterable<CountryLanguage> $countryLanguages
  288. */
  289. public function setCountryLanguages($countryLanguages): self
  290. {
  291. $this->countryLanguages = $countryLanguages;
  292. return $this;
  293. }
  294. /**
  295. * @return ArrayCollection<int, PackLanguage>&iterable<PackLanguage>
  296. */
  297. public function getPacks()
  298. {
  299. return $this->packs;
  300. }
  301. /**
  302. * @param ArrayCollection<int, PackLanguage>&iterable<PackLanguage> $packs
  303. */
  304. public function setPacks($packs): self
  305. {
  306. $this->packs = $packs;
  307. return $this;
  308. }
  309. /**
  310. * @return ArrayCollection<int, Answer>&iterable<Answer>
  311. */
  312. public function getAnswers()
  313. {
  314. return $this->answers;
  315. }
  316. /**
  317. * @param ArrayCollection<int, Answer>&iterable<Answer> $answers
  318. */
  319. public function setAnswers($answers): self
  320. {
  321. $this->answers = $answers;
  322. return $this;
  323. }
  324. /**
  325. * @return ArrayCollection<int, Question>&iterable<Question>
  326. */
  327. public function getQuestions()
  328. {
  329. return $this->questions;
  330. }
  331. /**
  332. * @param ArrayCollection<int, Question>&iterable<Question> $questions
  333. */
  334. public function setQuestions($questions): self
  335. {
  336. $this->questions = $questions;
  337. return $this;
  338. }
  339. public function __toString(): string
  340. {
  341. return ''.$this->getName();
  342. }
  343. }