<?php
namespace App\Core\Entity\InformacionPerfil;
use App\Core\Repository\InformacionPerfil\IdiomaRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=IdiomaRepository::class)
*/
class Idioma
{
const JSON_FIELDS = ['id', 'nombre', 'nombreIso', 'iso6392B'];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups("idioma")
*/
private $id;
/**
* @ORM\Column(type="string", length=50)
* @Groups("idioma")
*/
private $nombre;
/**
* @ORM\Column(type="string", length=90)
* @Groups("idioma")
*/
private $nombreIso;
/**
* @ORM\Column(type="string", length=5)
*/
private $iso6392B;
public function getId(): ?int
{
return $this->id;
}
public function getNombre(): ?string
{
//Obtiene el texto segun el idioma seleccionado del usuario
if($GLOBALS['request']->getLocale() === 'es')
return $this->nombre;
elseif ($GLOBALS['request']->getLocale() === 'en')
return $this->nombreIso;
else
return $this->nombreIso;
}
public function setNombre(string $nombre): self
{
$this->nombre = $nombre;
return $this;
}
public function getNombreIso(): ?string
{
return $this->nombreIso;
}
public function setNombreIso(string $nombreIso): self
{
$this->nombreIso = $nombreIso;
return $this;
}
public function getIso(): ?string
{
return $this->iso6392B;
}
public function setIso(string $iso): self
{
$this->iso6392B = $iso;
return $this;
}
}