Get the primary key value for a given items row
protected string primaryKeyValue ( yii\db\TableSchema $schema, array $items, $defaultValue ) | ||
$schema | yii\db\TableSchema | |
$items | array | |
$defaultValue | string |
protected function primaryKeyValue(TableSchema $schema, array $items, $defaultValue)
{
$values = [];
foreach ($schema->primaryKey as $keyName) {
if (array_key_exists($keyName, $items)) {
$values[] = $items[$keyName];
}
}
return empty($values) ? $defaultValue : implode("-", $values);
}