I have questions which are represented like this in my SQL database :
CREATE TABLE IF NOT EXISTS `t_question` (
`id_question` int(10) NOT NULL AUTO_INCREMENT,
`heading_key` varchar(255) NOT NULL,
PRIMARY KEY (`id_question`)
) ENGINE=InnoDB;
Because I want my questions to be multilanguage, I link their keys to another table (t_lang_data) which stores strings for several uses (questions, articles and so on).
My t_lang_data has the folowing structure :
CREATE TABLE IF NOT EXISTS `t_lang_data` (
`id_lang_data` int(10) NOT NULL AUTO_INCREMENT,
`key` varchar(255) NOT NULL,
`lang_iso` int(10) NOT NULL,
`text` varchar(255) NOT NULL,
PRIMARY KEY (`id_lang_data`)
) ENGINE=InnoDB;
So for example I could have this question :
id_question = 1 ; heading_key = heading_quest_1
And these lang_data entries :
id_lang_data = 1 ; key = heading_quest_1 ; lang_iso = en_UK ; text = "Heading for question 1" id_lang_data = 2 ; key = heading_quest_1 ; lang_iso = fr ; text = "Titre de la question 1"
I need to map these relations for Doctrine 2 but I do not know what to do. I have tried a many-to-one and a one-to-many approch but it does not work.
Do someone has an idea please ? Thanks
EDIT : I realize that it is even more difficult than what I thought. Indeed, my t_lang_data table can store strings for many tables such as t_questions, t_articles and so on. But in the mapping it seems that we can map only two tables together.
So how could I do ?