protected SqlContentEntityStorageSchema::getFieldSchemaData($field_name, array $field_schema, array $column_mapping, $schema_key)
Gets field schema data for the given key.
Parameters
string $field_name: The name of the field.
array $field_schema: The schema of the field.
string[] $column_mapping: A mapping of field column names to database column names.
string $schema_key: The type of schema data. Either 'indexes' or 'unique keys'.
Return value
array The schema definition for the specified key.
File
- core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 676
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\Sql
Code
protected function getFieldSchemaData($field_name, array $field_schema, array $column_mapping, $schema_key) { $data = array(); foreach ($field_schema[$schema_key] as $key => $columns) { // To avoid clashes with entity-level indexes or unique keys we use // "{$entity_type_id}_field__" as a prefix instead of just // "{$entity_type_id}__". We additionally namespace the specifier by the // field name to avoid clashes when multiple fields of the same type are // added to an entity type. $entity_type_id = $this->entityType->id(); $real_key = $this->getFieldSchemaIdentifierName($entity_type_id, $field_name, $key); foreach ($columns as $column) { // Allow for indexes and unique keys to specified as an array of column // name and length. if (is_array($column)) { list($column_name, $length) = $column; $data[$real_key][] = array($column_mapping[$column_name], $length); } else { $data[$real_key][] = $column_mapping[$column]; } } } return $data; }
Please login to continue.