问题
I'm new to Symfony and Sonata. After following the instructions i installed Translatable, but i dont get any Tab in the form.
Composer.json
"stof/doctrine-extensions-bundle": "1.1.x-dev",
"a2lix/translation-form-bundle": "2.x-dev"
config.yml
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
mappings:
gedmo_translatable:
type: annotation
prefix: Gedmo\Translatable\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
alias: GedmoTranslatable # this one is optional and will default to the name set for the mapping
is_bundle: false
stof_doctrine_extensions:
default_locale: "%locale%"
orm:
default:
translatable: true
a2lix_translation_form:
locales: [es, pr] # [1]
default_required: true # [2]
manager_registry: doctrine # [3]
templating: "A2lixTranslationFormBundle::default.html.twig" # [4]
Sonata AdminClass
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('descripcion')
->add('unidadMedida')
->add('translations', 'a2lix_translations')
;
}
回答1:
I had so much trouble trying to use those 2 bundles that I switched to using only a2lix bundles and it worked like a charm for me... This is what I am using now (sf 2.4)
"a2lix/i18n-doctrine-bundle": "dev-master",
"a2lix/translation-form-bundle": "2.*@dev",
来源:https://stackoverflow.com/questions/21990813/a2lixtranslationformbundle-with-stof-doctrineextensionsbundle-doesnt-show-any-ta