Hi:
I’ve researched this topic quite a bit on this forum and have also read the Definitive Guide but haven’t found a solution that applies to my particular situation, so I’ll appreciate any help I can get.
I’m starting to develop a multi tenant app where the relationship between users and tenants is MANY_MANY (that is, a user can belong to many tenants and a tenant can have many users):
tbl_users (1)---(M)> tbl_tenant_users <(N)---(1) tbl_tenants
What I want is a single user registration form that will create both the user and the tenant and will link them both through the associative table tbl_tenant_users.
While I have some idea of how to do it through a CFormModel to collect the data and then use DAO to manually store it in all 3 tables, I would prefer to use AR. The problem is I can’t figure out how will the associative table be updated with the primary keys of the users and tenant tables upon record creation. I believe I need something more that the relations() function in each model, but I don’t know what.
Any ideas? Thanks in advance.