Sunday, September 16, 2012

Re: Database scheme question...

That would do it. Then you need to set up your model associations.

public $hasOne = array(
'Manager' => array(
'className'    => 'User',
'foreignKey'   => 'manager_user_id'
),
'Contact' => array(
'className'    => 'User',
'foreignKey'   => 'contact_user_id'
)
);

On 15 Sep 2012, at 21:14, Jeff Prater <jeff@thoughtreactor.com> wrote:

I'm getting started with v2.2. I'm trying to layout my database, but I'm unsure how to handle the naming conventions. I have a main table, firms, which stores all the companies/firms For each firm, I want to designate a managing user and contact user from the users table. I need to associate a specific user account from the users table. Is this the correct way to name these? After reading the conventions section in the book, I'm still a little confused as how to name these columns. Thanks!

firms
---------
id
firm_name
manager_user_id  **
contact_user_id  **

users
---------
id
user_name
email_address
etc.



--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate