How to change Primary key of table in CakePHP

In the cakephp by default it consider primary key as 'id' in the table and this is the correct way to create the table. But if the primary key is not the field with 'id' and else value the in the model you can define your own primary key.

Example:

$this->User->primaryKey  =  'user_id';

Here User is the model name.

Comments

  1. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.
    PHP Course in Chennai|PHP Training Chennai

    ReplyDelete
  2. Hey, Wow Provided Post will be Very much Informative to the People Who Visit this Site. Good Work! Thank You for Sharing.
    Joomla training in chennai

    ReplyDelete
  3. Hey Nice Blog!! Thanks For Sharing!!!Wonderful blog & good post.Its really helpful for me, waiting for a more new post. Keep Blogging!
    Web Design Training

    ReplyDelete
  4. Informative post indeed, I’ve being in and out reading posts regularly and I see alot of engaging people sharing things and majority of the shared information is very valuable and so, here’s my fine read.
    https://www.bloglovin.com/@myaarpmedicarecomlogin/medicare-supplement click here to 2lz4drob
    https://myaarpmedicarecom.tumblr.com/post/185342653384/medicare-supplement click here click here
    http://myaarpmedicarecom22.bravesites.com/ click here code html
    https://www.evernote.com/shard/s343/sh/25778201-4f5f-4f82-8bc6-f6cfed8202ba/635a9f044644e3d48fdab133d3ac4f36 click here co 2lz4drob
     http://myaarpmedicareofficialsite.yolasite.com click here code

    ReplyDelete

Post a Comment