diff --git a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMappingInterface.php b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMappingInterface.php index 36be892..ecb63b8 100644 --- a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMappingInterface.php +++ b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMappingInterface.php @@ -10,27 +10,13 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; /** - * Provides an common interface for mapping field columns to SQL tables. + * Provides an interface to describe core default SQL table layout. */ interface DefaultTableMappingInterface extends TableMappingInterface { /** - * A list of columns that can not be used as field type columns. - * - * @return array - */ - public function getReservedColumns(); - - /** * Generates a table name for a field data table. * - * @private Calling this function circumvents the entity system and is - * strongly discouraged. This function is not considered part of the public - * API and modules relying on it might break even in minor releases. Only - * call this function to write a query that \Drupal::entityQuery() does not - * support. Always call entity_load() before using the data found in the - * table. - * * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition * The field storage definition. * @param bool $is_deleted @@ -45,13 +31,6 @@ public function getDedicatedDataTableName(FieldStorageDefinitionInterface $stora /** * Generates a table name for a field revision archive table. * - * @private Calling this function circumvents the entity system and is - * strongly discouraged. This function is not considered part of the public - * API and modules relying on it might break even in minor releases. Only - * call this function to write a query that \Drupal::entityQuery() does not - * support. Always call entity_load() before using the data found in the - * table. - * * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition * The field storage definition. * @param bool $is_deleted @@ -63,26 +42,4 @@ public function getDedicatedDataTableName(FieldStorageDefinitionInterface $stora */ public function getDedicatedRevisionTableName(FieldStorageDefinitionInterface $storage_definition, $is_deleted = FALSE); - - /** - * Generates a column name for a field data table. - * - * @private Calling this function circumvents the entity system and is - * strongly discouraged. This function is not considered part of the public - * API and modules relying on it might break even in minor releases. Only - * call this function to write a query that \Drupal::entityQuery() does not - * support. Always call entity_load() before using the data found in the - * table. - * - * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition - * The field storage definition. - * @param string $column - * The name of the column. - * - * @return string - * A string containing a generated column name for a field data table that is - * unique among all other fields. - */ - public function getFieldColumnName(FieldStorageDefinitionInterface $storage_definition, $column); - } diff --git a/core/lib/Drupal/Core/Entity/Sql/TableMappingInterface.php b/core/lib/Drupal/Core/Entity/Sql/TableMappingInterface.php index c6b5706..9607fe4 100644 --- a/core/lib/Drupal/Core/Entity/Sql/TableMappingInterface.php +++ b/core/lib/Drupal/Core/Entity/Sql/TableMappingInterface.php @@ -7,8 +7,20 @@ namespace Drupal\Core\Entity\Sql; +use Drupal\Core\Field\FieldStorageDefinitionInterface; + /** * Provides a common interface for mapping field columns to SQL tables. + * + * Warning: using methods provided here should be done only when writing code + * that is explicitly targeting a SQL-based entity storage. Typically this API + * is used by SQL storage classes, or other SQL-specific code like the Views + * integration code for the Entity SQL storage. Another example of legal usage + * of this API is when needing to write a query that \Drupal::entityQuery() does + * not support. Always retrieve entity identifiers and use them to load entities + * instead of accessing data stored in the database directly. Any other usage + * circumvents the entity system and is strongly discouraged, at least when + * writing contributed code. */ interface TableMappingInterface { @@ -70,4 +82,24 @@ public function getColumnNames($field_name); */ public function getExtraColumns($table_name); + /** + * A list of columns that can not be used as field type columns. + * + * @return array + */ + public function getReservedColumns(); + + /** + * Generates a column name for a field. + * + * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition + * The field storage definition. + * @param string $column + * The name of the column. + * + * @return string + * A string containing a generated column name for a field data table that is + * unique among all other fields. + */ + public function getFieldColumnName(FieldStorageDefinitionInterface $storage_definition, $column); }