getPrimaryKey() публичный Метод

Get the primary key field from the model or parameters
public getPrimaryKey ( Table $model ) : array
$model Cake\ORM\Table The model to introspect.
Результат array The columns in the primary key
Пример #1
0
 /**
  * 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);
 }