3.7.8.4 primaryKey

Each table normally has a primary key, id. You may change which field name the model uses as its primary key. This is common when setting CakePHP to use an existing database table.

Example usage:

class Example extends AppModel {
    var $primaryKey = 'example_id'; // example_id is the field name in the database
}
  1. class Example extends AppModel {
  2. var $primaryKey = 'example_id'; // example_id is the field name in the database
  3. }