You are here

protected function Schema::mapKeyDefinition in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php \Drupal\Core\Database\Driver\sqlite\Schema::mapKeyDefinition()

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

Parameters

$key_definition: The key definition.

$mapping: The new mapping.

1 call to Schema::mapKeyDefinition()
Schema::changeField in core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php
Change a field definition.

File

core/lib/Drupal/Core/Database/Driver/sqlite/Schema.php, line 575
Contains \Drupal\Core\Database\Driver\sqlite\Schema.

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