3

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!

4

1 回答 1

0

我解决了这个问题,从实体“翻译存储库”中检索翻译并将其传递给表单模型(我为处理翻译而创建的模型):

$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, ...);

我希望这会对某人有所帮助...

再见

于 2014-05-01T09:31:37.547 回答