in your service model set relation like this
$belongsTo = array(
'ServiceProvider' = array(
'className' = 'User',
'foreignKey' = 'served_by'
),
'ServiceUser' = array(
'className' = 'User',
'foreignKey' = 'served_to',
)
);
Then yopu can access the user who provides the service with $this-
Service-ServiceProvider and the $this-Service-ServiceUser for the
one who the service is provided to. Both of this virtual models refer
to the User model and users table
On Oct 6, 11:22 am, Jiru jiransl...@gmail.com wrote:
Hi CakePHP programmers,
plz help me..
We have two tables - users and services.
services table needs to have two fields (served_by served_to) -
both referring to user_id. That case, what should be field names in
services table because as per cakephp file naming conventions foreign
keys should always be: table_name_in_singular_form_id and in our case
it should be user_id. But we can't have two fields with same field
name.
Any thoughts on how we should name the two fields for services table ?
regards,
jiru
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---