I am building a type of contact manager. I have three different types of contacts: 1- Employees 2- Customers 3- Partners
I want them to link to one address table: 1- Addresses In working with Cake, I am using scaffolding to develop a prototype before any "real time" is spent on the development. So the question? What is the best way to structure the models so that the 3 contact tables can access 1 address table? Keep in mind that due to some differences in data, I cannot merge the 3 contact tables into one table. Partly because customers belong to partners and can be assigned to employees. Employees can also be assigned to partners. So we sould wind up right back to this same dilema anyway. I have thought of the following: table address ( id contact_type_id (identifies the contact table [employee/customer/partner]) owner_id (identifies the PK id from the contact table) address city state zip ) The problem is how, using scaffolding, can I get the addresses to associate to the correct table. Here is a sample I am currently using: Address Model var $belongsTo = array( 'Employees' => array( 'className' => 'Employee', 'conditions' => 'addresses.contact_type_id=1', 'foriegnKey' => 'id', ), 'Clients' => array( 'className' => 'Client', 'conditions' => 'addresses.contact_type_id=2', 'foriegnKey' => 'id', ), ); Client Model var $hasMany = array( 'Addresses' => array( 'className' => 'Address', 'foreignKey' => 'owner_id', 'dependent' => true, ), ); The problem is: 1- Does not reference the list of clients in the ADDRESSES->ADD (just shows a text field) 2- No addresses appear in the ADDRESSES page. However: 1- The address shows up in CLIENTS->VIEW What I can gather is the scaffolding for 'foriegnKey' => 'id' in the address model is clooking for client_id in the addresses table; however, it's labeled as owner_id. Is there anything that can be done so the following works in scaffolding: 1- The addresses will show up in the address list. 2- When ading an address the appropriate set of "contacts" populate the drop down. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---