Forums

hasMany relation usa

Szczypka 27 Jan, 2015
Hi,
I have two tables:
userData with fields: user1country, user2country, user3country, user4country where each of these fields stores the id of a country from the second table: countries (id, country_code, country_name)

How should I define the Country model so I can replace the ids in user1country, user2country, user3country, user4country with proper country names?

When I just put the model name to: Country
relation to hasMany
and associated model to userData
I left the rest empty
this is the debug output:
[4] => SELECT `Country`.`id` AS `Country.id`, `Country`.`country_code` AS `Country.country_code`, `Country`.`country_name` AS `Country.country_name` FROM `countries` AS `Country` WHERE `Country`.`userData_id` IN ('737')
This topic is locked and no more replies can be posted.