diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php index df6c3a7..28f7f97 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php @@ -12,7 +12,6 @@ use Drupal\Core\Database\Database; use Drupal\Core\Entity\Query\QueryInterface; use Drupal\Core\Entity\Schema\ContentEntitySchemaHandler; -use Drupal\Core\Entity\Schema\EntitySchemaProviderInterface; use Drupal\Core\Entity\Sql\DefaultTableMapping; use Drupal\Core\Entity\Sql\SqlEntityStorageInterface; use Drupal\Core\Field\FieldDefinitionInterface; @@ -31,18 +30,24 @@ * * This class can be used as-is by most simple entity types. Entity types * requiring special handling can extend the class. + * + * The class makes internally use of + * \Drupal\Core\Entity\Schema\ContentEntitySchemaHandler in order to + * automatically generate the database schema based on the defined base fields. + * Entity types can override ContentEntityDatabaseStorage::getSchema() to + * customize the generated schema; e.g., to add additional indexes. */ -class ContentEntityDatabaseStorage extends ContentEntityStorageBase implements SqlEntityStorageInterface, EntitySchemaProviderInterface { +class ContentEntityDatabaseStorage extends ContentEntityStorageBase implements SqlEntityStorageInterface { /** - * The base field definitions for this entity type. + * The storage field definitions for this entity type. * * @var \Drupal\Core\Field\FieldStorageDefinitionInterface[] */ protected $fieldStorageDefinitions; /** - * A mapping of schema fields that will be stored per entity table. + * The mapping of field columns to SQL tables. * * @var \Drupal\Core\Entity\Sql\TableMappingInterface */ @@ -58,7 +63,7 @@ class ContentEntityDatabaseStorage extends ContentEntityStorageBase implements S protected $revisionKey = FALSE; /** - * The entity langcode key + * The entity langcode key. * * @var string|bool */ @@ -665,7 +670,6 @@ public function save(EntityInterface $entity) { db_ignore_slave(); return $return; } - catch (\Exception $e) { $transaction->rollback(); watchdog_exception($this->entityTypeId, $e); @@ -719,7 +723,7 @@ protected function doSave($id, EntityInterface $entity) { ->execute(); // Even if this is a new entity the ID key might have been set, in which // case we should not override the provided ID. An empty value for the - // ID is interpreted as NULL and thus overriden. + // ID is interpreted as NULL and thus overridden. if (empty($record->{$this->idKey})) { $record->{$this->idKey} = $insert_id; } diff --git a/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php b/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php index 22e7629..ff0031a 100644 --- a/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php +++ b/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php @@ -1,4 +1,5 @@ array( 'description' => 'The ID of the target entity.', 'type' => 'varchar', - // If the target entities act as bundles for another entity type, their - // IDs should not exceed the maximum length for bundles. + // If the target entities act as bundles for another entity type, + // their IDs should not exceed the maximum length for bundles. 'length' => $target_type_info->getBundleOf() ? EntityTypeInterface::BUNDLE_MAX_LENGTH : 255, ), ); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockStorage.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockStorage.php index 32b9db0..b7b8711 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockStorage.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockStorage.php @@ -1,4 +1,5 @@