You are here

protected function TestSqlIdMap::getFieldSchema in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/tests/src/Unit/TestSqlIdMap.php \Drupal\Tests\migrate\Unit\TestSqlIdMap::getFieldSchema()

Create schema from an id definition.

Parameters

array $id_definition: A field schema definition. Can be SQL schema or a type data based schema. In the latter case, the value of type needs to be $typed_data_type.$column

Return value

array

Overrides Sql::getFieldSchema

File

core/modules/migrate/tests/src/Unit/TestSqlIdMap.php, line 47
Contains \Drupal\Tests\migrate\Unit\TestSqlIdMap.

Class

TestSqlIdMap
Defines a SQL ID map for use in tests.

Namespace

Drupal\Tests\migrate\Unit

Code

protected function getFieldSchema(array $id_definition) {
  if (!isset($id_definition['type'])) {
    return array();
  }
  switch ($id_definition['type']) {
    case 'integer':
      return array(
        'type' => 'int',
        'not null' => TRUE,
      );
    case 'string':
      return array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      );
    default:
      throw new MigrateException($id_definition['type'] . ' not supported');
  }
}