public DefaultTableMapping::getFieldColumnName(FieldStorageDefinitionInterface $storage_definition, $property_name)
Generates a column name for a field property.
Parameters
\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The field storage definition.
string $property_name: The name of the property.
Return value
string A string containing a generated column name for a field data table that is unique among all other fields.
Overrides TableMappingInterface::getFieldColumnName
File
- core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php, line 200
Class
- DefaultTableMapping
- Defines a default table mapping class.
Namespace
Drupal\Core\Entity\Sql
Code
public function getFieldColumnName(FieldStorageDefinitionInterface $storage_definition, $property_name) { $field_name = $storage_definition->getName(); if ($this->allowsSharedTableStorage($storage_definition)) { $column_name = count($storage_definition->getColumns()) == 1 ? $field_name : $field_name . '__' . $property_name; } elseif ($this->requiresDedicatedTableStorage($storage_definition)) { if ($property_name == TableMappingInterface::DELTA) { $column_name = 'delta'; } else { $column_name = !in_array($property_name, $this->getReservedColumns()) ? $field_name . '_' . $property_name : $property_name; } } else { throw new SqlContentEntityStorageException("Column information not available for the '$field_name' field."); } return $column_name; }
Please login to continue.