src/Core/Entity/InformacionPerfil/Idioma.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Core\Entity\InformacionPerfil;
  3. use App\Core\Repository\InformacionPerfil\IdiomaRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. /**
  7. * @ORM\Entity(repositoryClass=IdiomaRepository::class)
  8. */
  9. class Idioma
  10. {
  11. const JSON_FIELDS = ['id', 'nombre', 'nombreIso', 'iso6392B'];
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. * @Groups("idioma")
  17. */
  18. private $id;
  19. /**
  20. * @ORM\Column(type="string", length=50)
  21. * @Groups("idioma")
  22. */
  23. private $nombre;
  24. /**
  25. * @ORM\Column(type="string", length=90)
  26. * @Groups("idioma")
  27. */
  28. private $nombreIso;
  29. /**
  30. * @ORM\Column(type="string", length=5)
  31. */
  32. private $iso6392B;
  33. public function getId(): ?int
  34. {
  35. return $this->id;
  36. }
  37. public function getNombre(): ?string
  38. {
  39. //Obtiene el texto segun el idioma seleccionado del usuario
  40. if($GLOBALS['request']->getLocale() === 'es')
  41. return $this->nombre;
  42. elseif ($GLOBALS['request']->getLocale() === 'en')
  43. return $this->nombreIso;
  44. else
  45. return $this->nombreIso;
  46. }
  47. public function setNombre(string $nombre): self
  48. {
  49. $this->nombre = $nombre;
  50. return $this;
  51. }
  52. public function getNombreIso(): ?string
  53. {
  54. return $this->nombreIso;
  55. }
  56. public function setNombreIso(string $nombreIso): self
  57. {
  58. $this->nombreIso = $nombreIso;
  59. return $this;
  60. }
  61. public function getIso(): ?string
  62. {
  63. return $this->iso6392B;
  64. }
  65. public function setIso(string $iso): self
  66. {
  67. $this->iso6392B = $iso;
  68. return $this;
  69. }
  70. }