I have simply Entity:
/**
* Claudio\PageBundle\Entity\Page
*/
class Page
{
//
private $id;
private $title;
private $text_en;
private $text_fr;
//getters and setters for all
}
And i would add for this getter:
public function getText()
{
$culture = ???;
if($culture == 'en') return $this->getTextEn();
if($culture == 'fr') return $this->getTextFr();
}
but how can i get Culture/Local in Entity class? I know - i can make it by using Controller or Twig, but i would like use this in all views etc by $page->getText(). Is possible to make in Entity?
setlocale(LC_ALL, 0);
Will return the locales that are set. It might return more than one locale.