Wednesday, September 19, 2012

Re: Database scheme question...

Check out the Model Associations:
http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html

On Tuesday, 18 September 2012 05:27:34 UTC+3, Jeff Prater wrote:
Thanks for the quick reply!

Where would I be adding this? To the User model or to the Firms model? Or both?

On Sunday, September 16, 2012 4:30:37 AM UTC-4, Jeremy Burns wrote:
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 <je...@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...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
 
 

No comments: