I have a simple form with a choice type which is an simple entity:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', 'entity', [
'class' => 'AppBundle\Entity\Type',
'property' => 'name',
'expanded' => true
]
);
}
The entity type
is a database table with just an idType AI column
and a name column
.
The database content is also pretty simple:
idType name
"1" "term.inquiry"
"2" "term.tender"
And the result in a twig file looks pretty simple too:
{{ form_start(form) }}
{{ form_widget(form.name) }}
{{ form_end(form) }}
I'm really stucked in how to implement the translation method to translate the term.inquiry
and term.tender
I've looked up the documentation here, but I don't know how to implement (the correct way) the getTranslationMessages
method via the TranslationContainerInterface
. I've also tried the answer here but didn't know how to match the return array with the choices in my buildForm
method.
Any suggestions or hints for a best practice implementation? Many thanks in advance