gedmo doctrine translatable extension. Retrieve all translations or a specific one (different from the current locale)

StackOverflow https://stackoverflow.com/questions/17107092

Question

I've an entity that uses gedmo doctrine translatable extension. I'm able to load this entity in the current locale.

Now, for an admin panel where I want users to see and edit the various translations, I want to show all the translations or a specific one chosen by the user.

I just have the ->getTranslations method on that entity. There's another trick to load just the select translation? Is there any best practice for the given scenario?

Thanks a lot!

Was it helpful?

Solution

I solved this retrieving the translations from the entity "Translation Repository" and passing to the Form Model (a model i created to handle the translations):

$nodeRepository = $this->getDoctrine()->getRepository('AcmeCoreBundle:Node');
$node = $repository->find($id);

$translationsRepository = $this->getDoctrine()>getRepository('Acme\CoreBundle\Entity\NodeTranslation');

// retrieving the translations for the given node
$translations = $repository->findTranslations($node);

$model = new TranslatableModel($node, $translations, ...);

I hope this would help someone...

Ciao

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top