W3cubDocs

/Drupal 8

protected function 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 574

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Driver!sqlite!Schema.php/function/Schema::mapKeyDefinition/8.1.x