1

I am using translatable table by doctorine2 extension

I have successfully implemented input and output data for each languages.

However I would like to edit the multiple language at the same time. like this below this codes is not correct, however that's what I want to do.

Is there good solution for this purpose?

in php

$form = $this->createFormBuilder($attrSchool)
        ->add('description fr')
        ->add('description ch)
        ->add('description en)->getForm();

in twig

<form action="http://myserver.com/">
{{ form_widget(form.description fr) }}
{{ form_widget(form.description ch) }}
{{ form_widget(form.description en) }}

<input type=submit>
</form>

Now I understood I should use github.com/a2lix/TranslationFormBundle thanks to the @ghanbari 's comment

So, I decided to choose.

"stof/doctrine-extensions-bundle": "1.2.*@dev",

and

"a2lix/translation-form-bundle": "1.*@dev",

then set up according to here

then I set up a2lix in my sonataadminbundle class myEntity.php

   $formMapper
        ->with('General')
          ->add('description','a2lix_translations_gedmo', array(
'translatable_class' => 'Acme\UserBundle\Entity\myEntity'))

when I choose 'Add new' in admin bundle page translation tab appear correctly.

However I choose edit existed-one,

Expected argument of type "object, array or empty", "string" given

this error message appears.

'Acme\UserBundle\Entity\myEntity' is surely the class existing in my project.

Why it happens ?

ghanbari
  • 1,630
  • 1
  • 16
  • 31
whitebear
  • 11,200
  • 24
  • 114
  • 237
  • you can use this bundle: https://github.com/a2lix/TranslationFormBundle – ghanbari Apr 16 '15 at 23:05
  • Thanks great suggestion, but I found a2lix is not compatible with my stof/doctrine-extensions-bundle. Same problem is discussed here http://stackoverflow.com/questions/21990813/a2lixtranslationformbundle-with-stof-doctrineextensionsbundle-doesnt-show-any-ta. – whitebear Apr 16 '15 at 23:34
  • 1
    I will try "a2lix/i18n-doctrine-bundle" at the same time. thanks a lot. – whitebear Apr 16 '15 at 23:34
  • It seems quite useful, but somehow i18-doctrine-bundle doesn't work well in my environment. I will search another way... – whitebear Apr 17 '15 at 06:59
  • what is your problem with i18-doctrine-bundle? – ghanbari Apr 17 '15 at 08:13
  • why u no use https://github.com/Atlantic18/DoctrineExtensions ? – ghanbari Apr 17 '15 at 08:14
  • mmm, I didnt' understand the difference between Atralntic18/DoctrineExtensions and stof/doctrine-extensions-bundle. At first I thought stof/doctrine-extensions-bundle include Atrantic18/DoctrineExtension...... – whitebear Apr 17 '15 at 16:13
  • yes, stof/doctrine-extensions-bundle is a bundle for symfony that wrap Atralntic18/DoctrineExtensions – ghanbari Apr 17 '15 at 16:16
  • I understood , so you mean these are basically the same. Now I updated the article.... – whitebear Apr 17 '15 at 17:31
  • you use which sonata version? – ghanbari Apr 17 '15 at 18:00
  • "sonata-project/admin-bundle": "dev-master", "sonata-project/cache-bundle": "dev-master", "sonata-project/block-bundle": "dev-master", "sonata-project/doctrine-orm-admin-bundle" : "2.2.7", "sonata-project/core-bundle": "~2.2@dev", These are my setting for sonata – whitebear Apr 17 '15 at 21:37

0 Answers0