Get the primary key field from the model or parameters
public getPrimaryKey ( |
||
$model | The model to introspect. | |
return | array | The columns in the primary key |
/** * Test getting primary key * * @return void */ public function testGetPrimaryKey() { $model = TableRegistry::get('BakeArticles'); $result = $this->Task->getPrimaryKey($model); $expected = ['id']; $this->assertEquals($expected, $result); $this->Task->params['primary-key'] = 'id, , account_id'; $result = $this->Task->getPrimaryKey($model); $expected = ['id', 'account_id']; $this->assertEquals($expected, $result); }