A2lixTranslationFormBundle with Stof DoctrineExtensionsBundle: 500 Internal Server Error - ReflectionException

439 views Asked by At

I'm trying to do a simple translable entity using these (composer.json):

    "php": ">=5.3.3",
    "symfony/symfony": "~2.4",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": "~1.2",
    "stof/doctrine-extensions-bundle": "~1.1@dev",
    "a2lix/translation-form-bundle": "2.*@dev"

My entity (country) has a field (name) translable:

<?php

namespace Zen\MyBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Translatable\Translatable;

/**
 * @ORM\Entity
 */
class Country {

    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue
     */
    private $id;

    /**
     * @Gedmo\Translatable
     * @ORM\Column(name="name", type="string", length=128)
     */
    private $name;


    /**
     * @Gedmo\Locale
     * Used locale to override Translation listener`s locale
     * this is not a mapped field of entity metadata, just a simple property
     */
    private $locale;

    public function setTranslatableLocale($locale) {
        $this->locale = $locale;
    }

}

config.yml say:

stof_doctrine_extensions:
    default_locale: en_US
    orm:
        default: 
            tree: true        
            blameable: true
            translatable: true
            loggable: true
a2lix_translation_form:
    locales: [en, it]       
    required_locales: [en]
    manager_registry: doctrine      
    templating: "A2lixTranslationFormBundle::default.html.twig" 

And now I want using this a2lix/TranslationFormBundle in sonataAdmin:

protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
                ->add('name', 'a2lix_translations');
        ;
    }

But I get this error in create (sonata admin):

Class Zen\MyBundle\Entity\CountryTranslation does not exist
500 Internal Server Error - ReflectionException

Where is my mistake?

Are there some angels that's can help me?

v.

1

There are 1 answers

0
gp_sflover On

As the error message says, you have to build also the "CountryTranslation" entity.

To do it you need to follow carefully the bundle documentation related to the version you have installed.

To avoid unexpected behaviors, remember to check the compatibility of the version of the A2lix bundle that you already have with the Gedmo version included in the stofbundle (and obviously the symfony version) because there are some dependancies. If necessary you can consider an upgrade (or downgrade) of the needed component.

I hope to be clear and sorry if my english is not so good :-).