Schema::mapKeyDefinition

protected Schema::mapKeyDefinition(array $key_definition, array $mapping)

Utility method: rename columns in an index definition according to a new mapping.

Parameters

$key_definition: The key definition.

$mapping: The new mapping.

File

core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php, line 586

Class

Schema
SQLite implementation of \Drupal\Core\Database\Schema.

Namespace

Drupal\Core\Database\Driver\sqlite

Code

protected function mapKeyDefinition(array $key_definition, array $mapping) {
  foreach ($key_definition as &$field) {
    // The key definition can be an array($field, $length).
    if (is_array($field)) {
      $field = &$field[0];
    }
    if (isset($mapping[$field])) {
      $field = $mapping[$field];
    }
  }
  return $key_definition;
}
doc_Drupal
2016-10-29 09:39:59
Comments
Leave a Comment

Please login to continue.