In this case you'll have to tell Cake what the primary key is:
http://book.cakephp.org/view/437/primaryKey

Why would you want to name it this way though? An "id" column in the  
Category table is obviously going to be the "Category.id".  
"Category.category_id" seems pretty redundant to me, and in Cake  
conventions it looks like a belongsTo association field at first glance.

On 6 Nov 2008, at 08:44, Rey Philip wrote:

>
> hi guys,
>
>   I just would like to ask about creating tables. I have read a book
> "Apress Beginning CakePHP" in chapter 2 it says there that
>
> "Giving each record a unique id value is essential for Cake to
> function without trouble.
> This application is simple, so you may be able to get by without
> creating an id field set to
> auto_increment. However, it’s good practice to make sure that all your
> records in the database
> can be identified by a unique value and that it’s named id, because
> then Cake can generate
> scaffolding around your table without any code on your part. Once you
> begin creating associated
> tables, then it will be mandatory to include an id field."
>
> My question is, I want to change the id field into another name, let's
> say category_id. Example I have a category table like this.
>
> category_table
> fields: category_id, name, description
>
> Will this work in the scaffolding feature?
>
> Here's my entire problem....Sample I have  a not real world example
> haha...
>
> products has one to one relationship with category.
>
> product has one category
> category has one product
>
> product
> fields: id, name, description
>
> category
> fields category_id, name, description, product_id
>
> can this be possible using cake's scaffolding feature?
> if possible how?
>
> Good day.....
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to