I’m prety new to yii framework so i could use some help with something.
Lets say i got a table in my database with users, 1 of the profile fields is nationality.
In another table i got a lot of nationalities like this:
id Nationality short
1 Germany DE
2 France FR
3 Netherlands NL
etc… about 60+ nationalities.
In the usertable, the user nationality is linked with this table, like this:
id username nationality
1 user 1
that means the nationality of user 1 = germany. but how can i select germany from the nationalities table when im in the profile view?
i hope im clear, else ask 🙂
greets,
stefan.
You need model classes for both tables, e.g.
Then in the
Profilemodel you need a relation toNationality:The name of the relation
'nationality'is how you refer to the related model, e.g.:Resources