function TestSqlIdMap::getFieldSchema
Same name in other branches
- 8.9.x core/modules/migrate/tests/src/Unit/TestSqlIdMap.php \Drupal\Tests\migrate\Unit\TestSqlIdMap::getFieldSchema()
- 10 core/modules/migrate/tests/src/Unit/TestSqlIdMap.php \Drupal\Tests\migrate\Unit\TestSqlIdMap::getFieldSchema()
- 11.x core/modules/migrate/tests/src/Unit/TestSqlIdMap.php \Drupal\Tests\migrate\Unit\TestSqlIdMap::getFieldSchema()
Gets the field schema.
Parameters
array $id_definition: An array defining the field, with a key 'type'.
Return value
array A field schema depending on value of key 'type'. An empty array is returned if 'type' is not defined.
Throws
\Drupal\migrate\MigrateException
Overrides Sql::getFieldSchema
1 method overrides TestSqlIdMap::getFieldSchema()
- SqlIdMapTest::getFieldSchema in core/
modules/ migrate/ tests/ src/ Kernel/ Plugin/ id_map/ SqlTest.php - Gets the field schema.
File
-
core/
modules/ migrate/ tests/ src/ Unit/ TestSqlIdMap.php, line 64
Class
- TestSqlIdMap
- Defines a SQL ID map for use in tests.
Namespace
Drupal\Tests\migrate\UnitCode
protected function getFieldSchema(array $id_definition) {
if (!isset($id_definition['type'])) {
return [];
}
switch ($id_definition['type']) {
case 'integer':
return [
'type' => 'int',
'not null' => TRUE,
];
case 'string':
return [
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
];
default:
throw new MigrateException($id_definition['type'] . ' not supported');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.