updating to a linked table

Hi all

here’s my situation…I have three tables

table1 - maps

id (key)


....

table2 - users

id (key)


....

tables - map_users

id (key)


map_id (foreign key, id from maps table)


user_id (foreign key, id from user table)

the map_users is a link between maps and user table.

a user can be linked to many maps

When I create a map and hit save the model handles the info for the map table. I know the user information (assuming he is logged in). I want to save in the map_users table the user_id as well as the newly created map_id

what is the best way to achieve this within the map model?

how can I access the map_id that just created ?

thanks

Pabs

Have a look at this extension. I’ve used it several times and it’s easy to configure. Post back here if you get stuck.

http://www.yiiframework.com/extension/cadvancedarbehavior/

Matt