Would it not be simpler to have the following tables and associations/
relationships:

Tables: users, addresses, addresstypes

Models: User, Address, Addresstype

With associations/relationships:
User hasMany/belongsTo Address
Address belongsTo/hasMany Addresstype

Where addresstypes identifies whether an address is a private address
or a company address (and others if necessary).

Thus in a form, the user enters the address, and chooses the
addresstype, saves, and all is well :)

Would the above satisfy your requirements?
Enjoy,
   John


On Feb 5, 9:26 pm, Robert K <[email protected]> wrote:
> user needs to store addresses.
> Address table can store addresses for any type of relationship, users,
> companies, etc.
>
> user_addresses,
> company_addresses, ...
>
> addresses table (id,address1,address2,city,zip,...)
>
> user_addresses (id,user_id,address_id)
> company_addresses (id,company_id,address_id)
>
> so when creating a user, what will happen is not only will cake create
> the relationship bonding in the <obj>_addresses table, but also
> creating the address record in the addresses table.
>
> I could not figure out a legitimate way in cakePHP to do this with the
> saveAll function.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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

Reply via email to