我有实体,有2个可移植的领域,利用可转移的理论延伸:
class Page implements Translatable
{
/......
/**
* @var string $name
* @GedmoTranslatable
* @ORMColumn(name="name", type="string", length=255)
*/
private $name;
/**
* @var text $content
* @GedmoTranslatable
* @ORMColumn(name="content", type="text")
*/
private $content;
/........
}
I use one table for multiple entities translations. Now i would like to use one form to get the original and translated (to 1 language) values for these attributes, so it should have 4 fields.
I ve defined new form derivating from AbstractType and tried to add those 2 fields using FormBuilder, but it says that their corresponding entities do not contain these fields. I ve tried to add these fields to entities, and declare getters for them, but the only way i know to get translations for entities is to use dedicated entity manager and AFAIK providing entity manager access to entity isn t good practice.
是否有办法使用处理此类事情的形式?