tags:

views:

50

answers:

2

Hi all,

I am learning the Model relationship types in cakephp.
I have built two tables and in one of the Table A,
I got these fields in it:

Table A {postID, topic, content} 
Table B {replyID, content, postID}

And when I ran the web page, a bunch of error related to SQL
popped up saying that cakephp couldn't find post_id.

It is weird that I have already declared
the $primaryKey to be using postID in the tableA.php under Models folder,
but cakephp seemed want me to change the ID field to post_id instead of postID, because the error disappeared after I have changed the primaryKey to post_id.

ANy ideas?

+4  A: 

Cake expects your fields to be lower case, with words separated by underscores. See the CakePHP Model and Database Naming Conventions for more information.

Mike Pelley
+1  A: 

By convention the field with the primary key is named id.

dhofstet