如何在字符串中的var中翻译entityType字段的choice_label?
$builder->add('shippingAddress', EntityType::class, array(
'class' => 'LilWorksStoreBundle:Address' ,
'choice_label' => function ($obj) {
return "String to translate with " . $obj->getName() ;
},
'query_builder' => function (EntityRepository $er) use ($customer) {
return $er->createQueryBuilder('a')
->leftJoin('LilWorksStoreBundle:Customer', 'c', 'WITH', 'c.id = a.customer')
->where('c.id = :id')
->setParameter('id',$customer->getId())
;
},
'required' => false ,
'mapped'=> true,
'expanded' => true ,
'multiple' => false,
'translation_domain' => 'my_translation'
));
答案 0 :(得分:0)
尝试这种方式:
'choice_translation_domain' => 'my_translation'