Re: Table Joins

2010-01-27 Thread Annamalai
Hi,

Tables :
1.user_profiles
  fields :- userid (PK)

2. Memberships
  fields :-membid , userid (reference to users profile )

Can you help me over this issue.?



Solution :
  user_profiles table : id

memberships table: id, user_profile_id (it will refers the user_profile
table)

* please read the basic naming conventions

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 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


Table Joins

2010-01-26 Thread Uresh

Hi...I am Uresh Patel from india.
I am cakephp beginner.
I took reference from your Table Rename Join Error topic.
I am trying to use inner join between only two tables.

Tables : 
1.user_profiles
   fields :- userid (PK)

2. Memberships
   fields :-membid , userid (reference to users profile )

Can you help me over this issue.?

Thank You

Regards,
Uresh Patel
[ uresh.pa...@ifuturz.com ]
http://old.nabble.com/file/p27334701/controllers.rar controllers.rar 
-- 
View this message in context: 
http://old.nabble.com/Table-Joins-tp27334701p27334701.html
Sent from the CakePHP mailing list archive at Nabble.com.

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 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


Re: Table Joins

2010-01-26 Thread Jeremy Burns
Table joins take place in the model using the $belongsTo, $hasMany and 
$hasAndBelongsToMany variables. See 
http://book.cakephp.org/view/78/Associations-Linking-Models-Together.

Jeremy Burns


On 27 Jan 2010, at 06:31, Uresh wrote:

 
 Hi...I am Uresh Patel from india.
 I am cakephp beginner.
 I took reference from your Table Rename Join Error topic.
 I am trying to use inner join between only two tables.
 
 Tables : 
 1.user_profiles
   fields :- userid (PK)
 
 2. Memberships
   fields :-membid , userid (reference to users profile )
 
 Can you help me over this issue.?
 
 Thank You
 
 Regards,
 Uresh Patel
 [ uresh.pa...@ifuturz.com ]
 http://old.nabble.com/file/p27334701/controllers.rar controllers.rar 
 http://old.nabble.com/file/p27334701/models.rar models.rar 
 -- 
 View this message in context: 
 http://old.nabble.com/Table-Joins-tp27334701p27334701.html
 Sent from the CakePHP mailing list archive at Nabble.com.
 
 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 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

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 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


Naming convention for same table joins

2006-10-02 Thread akoylds

Cake Version: 1.1.8.3544
PHP Version: 4.3.2

Hi,

I am looking to have a join table in my database which is a join of the
same table:


CREATE TABLE `builds` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)

Per the documentation, the naming convention for this is:
*many-to-many join tables should be named:
alphabetically_first_table_plural_alphabetically_second_table_plural
ie: tags_users

*columns in many-to-many join tables should be named like other foreign
keys ie: tag_id and user_id

So I would end up with

CREATE TABLE `builds_builds` (
  `id` int(11) NOT NULL auto_increment,
  `build_id` int(11) NOT NULL auto_increment,
  `build_id` int(11) NOT NULL auto_increment,
  PRIMARY KEY  (`id`)
)

which obviously won't work. Is there a way for CakePHP to handle this?

To anticipate the first question of 'what in the heck are you doing',
basically I am building a project release website which tracks
clearcase labels against projects and project-components. From the apps
perspective project and project-components are the same thing
(components are just small projects). So a project can be composed of
other projects.

After looking around the related sites, i've been unable to find
anything. Any help would be great!

David


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Naming convention for same table joins

2006-10-02 Thread [EMAIL PROTECTED]

You can tell the HABTM association the name of the associated and
foreignKeys.  So, whatever you set it to besides build_id for the
second one just give the name explicitly in your association and
everything should work out fine.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---