I'm having a table with all translations in a "ext_translations" table.
The translating works great. The problem is now: I want to manage those translations via sonata-admin bundle.
I have already found a documentation, how to get work doctrine extensions with sonata admin. But in my case I have ONE table/entity for all my translations (for multiple entities).
So according to this documentation: http://www.elao.com/blog/symfony-2/doctrine-2/how-to-manage-translations-for-your-object-using-sonataadminbundle.html what should be my mappedBy attribute (see below)?
ext_translations table:
mysql> show columns from ext_translations;
+--------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| locale | varchar(8) | NO | MUL | NULL | |
| object_class | varchar(255) | NO | | NULL | |
| field | varchar(32) | NO | | NULL | |
| foreign_key | varchar(64) | NO | | NULL | |
| content | longtext | YES | | NULL | |
+--------------+--------------+------+-----+---------+----------------+
MappedBy:
/**
* @ORM\OneToMany(targetEntity="ProfileTranslation", mappedBy="object", cascade={"persist", "remove"})
*/
protected $translations;
As far as I understood the problem here: "I have a composite key (objectclass (the entity) + name (of the attribute) + foreignKey (id of entity)), so how should the 'mappedBy' refer to this?
I don't want to create an extra class for each translatable entity (like in the tutorial from above)