我正在尝试使用这些(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"
我的实体(国家)有一个可翻译的字段(名称):
<?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 说:
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"
现在我想a2lix/TranslationFormBundle
在sonataAdmin中使用它:
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name', 'a2lix_translations');
;
}
但我在创建(奏鸣曲管理员)时收到此错误:
Class Zen\MyBundle\Entity\CountryTranslation does not exist
500 Internal Server Error - ReflectionException
我的错误在哪里?
有没有可以帮助我的天使?
五。