Tuesday, January 8, 2013

Re: Cake 2.0 - How to Specify a Primary Key

http://book.cakephp.org/2.0/en/models/model-attributes.html#primarykey

app/Models/User.php :

class User extends AppModel {
public $primaryKey = 'users_id';
}


Andras Kende
http://www.kende.com

On Jan 8, 2013, at 1:52 PM, Brian QIS <bhansen@quasars.com> wrote:

> Hello,
>
> We're coming from a custom CMS, and our MySQL database naming convention is a bit different. So, if I have a table called "users" with a primary key of "users_id", how do I set my model to look for "users.users_id" as the record ID rather than "users.id?"
>
> Thanks!
>
> --
> Like Us on FaceBook 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.
>
>

--
Like Us on FaceBook 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: