help in relations

3 tables: agent (id, user_id, agency_id) user (id, person_id) person (id, name, surname). i want the user_id field in agent table to display the name and surname from the person table in a drop down… any idea ?

i have 3 tables: agent (id, user_id, agency_id) user (id, person_id) person (id, name, surname).

i want the user_id field in agent table to display the name and surname from the person table in a

drop down… any idea ?

cos this name, surname from my person table to display in a dropdown for the user’s field in the

create new agent is driving me nuts :(

is the relations functions for the agent model is ‘users’ => array(self::HAS MANY, ‘Person’, ‘user_id’) ?

if i could get a link on how to display the name,surname of the person table inside my dropdown field for choose user in my ‘create new agent’ form, i would be relieved

so my User model will consist of the following relations

return array(

		'touroperatoragents' => array(self::HAS_MANY, 'Agent', 'el_user_id'),


		'users' => array(self::BELONGS_TO,'Person','el_person_id')


	)

for the above mentioned code i was asked to define the relations in those models from which you’ll access the related data. e.g. if you want to fetch all agents for a user, you’ll have to declare a has_many relationship to your agent model inside your user model. if you want to fetch the person the user belongs to, you have to declare a belongs_to relationship to your person model in your user model.

if you want to fetch all users for a person, you have to declare a has_many relationship to your user model in your person model