protected SqlContentEntityStorageSchema::getSchemaFromStorageDefinition(FieldStorageDefinitionInterface $storage_definition)
Gets the schema data for the given field storage definition.
Parameters
\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The field storage definition. The field that must not have custom storage, i.e. the storage must take care of storing the field.
Return value
array The schema data.
File
- core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 208
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\Sql
Code
protected function getSchemaFromStorageDefinition(FieldStorageDefinitionInterface $storage_definition) { assert('!$storage_definition->hasCustomStorage();'); $table_mapping = $this->storage->getTableMapping(); $schema = []; if ($table_mapping->requiresDedicatedTableStorage($storage_definition)) { $schema = $this->getDedicatedTableSchema($storage_definition); } elseif ($table_mapping->allowsSharedTableStorage($storage_definition)) { $field_name = $storage_definition->getName(); foreach (array_diff($table_mapping->getTableNames(), $table_mapping->getDedicatedTableNames()) as $table_name) { if (in_array($field_name, $table_mapping->getFieldNames($table_name))) { $column_names = $table_mapping->getColumnNames($storage_definition->getName()); $schema[$table_name] = $this->getSharedTableFieldSchema($storage_definition, $table_name, $column_names); } } } return $schema; }
Please login to continue.