{IT} - 3.7.8.4 $primaryKey
Se il modello è associato ad una tabella, questo attributo contiene il nome della colonna della chiave primaria della tabella. Il valore di default è 'id'.
{EN} - 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
} class Example extends AppModel {var $primaryKey = 'example_id'; // example_id is the field name in the database}
Differences
| Lines: 1-7 | Lines: 1-3 | ||
| - | <title>primaryKey</title> <p>Each table normally has a primary key, <code>id</code>. 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.</p> |
+ | <title>$primaryKey</title> <p>Se il modello è associato ad una tabella, questo attributo contiene il nome della colonna della chiave primaria della tabella. Il valore di default è 'id'.</p> |
| - | <p>Example usage:</p> | ||
| - | <pre>class Example extends AppModel { | ||
| - | var $primaryKey = 'example_id'; // example_id is the field name in the database | ||
| - | }</pre> | ||
