diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php index 25cf590..cff4c03 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php @@ -1469,7 +1469,7 @@ public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $ } // Update the field schema. - $this->schemaHandler()->markFieldSchemaAsDeleted($storage_definition); + $this->schemaHandler()->prepareFieldSchemaDeletion($storage_definition); } /** diff --git a/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php b/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php index 614ef02..c7ad754 100644 --- a/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php +++ b/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandler.php @@ -523,9 +523,10 @@ protected function createSharedTableSchema(FieldStorageDefinitionInterface $stor /** * {@inheritdoc} */ - public function markFieldSchemaAsDeleted(FieldStorageDefinitionInterface $storage_definition) { + public function prepareFieldSchemaDeletion(FieldStorageDefinitionInterface $storage_definition) { $table_mapping = $this->storage->getTableMapping(); - // TODO Do we need this also for shared table storage? + // @todo Implement this also for shared table storage. See + // https://www.drupal.org/node/2282119. if ($table_mapping->requiresDedicatedTableStorage($storage_definition)) { // Move the table to a unique name while the table contents are being // deleted. diff --git a/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandlerInterface.php b/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandlerInterface.php index 0feac4f..37a532f 100644 --- a/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandlerInterface.php +++ b/core/lib/Drupal/Core/Entity/Schema/ContentEntitySchemaHandlerInterface.php @@ -50,12 +50,12 @@ public function updateEntitySchema(ContentEntityTypeInterface $entity_type, Cont public function createFieldSchema(FieldStorageDefinitionInterface $storage_definition); /** - * Marks the storage schema for the given field as deleted. + * Prepares the storage schema for the given field for deletion. * * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition * The storage definition of the field being deleted. */ - public function markFieldSchemaAsDeleted(FieldStorageDefinitionInterface $storage_definition); + public function prepareFieldSchemaDeletion(FieldStorageDefinitionInterface $storage_definition); /** * Deletes the storage schema for the given field. diff --git a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php index 28cde11..5284478 100644 --- a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php +++ b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php @@ -208,7 +208,7 @@ function allowsSharedTableStorage(FieldStorageDefinitionInterface $storage_defin * {@inheritdoc} */ function requiresDedicatedTableStorage(FieldStorageDefinitionInterface $storage_definition) { - return !$storage_definition->hasCustomStorage() && (!isset($this->baseFieldDefinitions[$storage_definition->getName()]) || $storage_definition->isMultiple()); + return !$storage_definition->hasCustomStorage() && !$this->allowsSharedTableStorage($storage_definition); } /** diff --git a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMappingInterface.php b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMappingInterface.php index a9e0ebf..9942475 100644 --- a/core/lib/Drupal/Core/Entity/Sql/DefaultTableMappingInterface.php +++ b/core/lib/Drupal/Core/Entity/Sql/DefaultTableMappingInterface.php @@ -17,9 +17,6 @@ /** * Returns a list of dedicated table names for this mapping. * - * TODO Do we really need this or should we return everything in - * TableMappingInterface::getTableNames()? - * * @return string[] * An array of table names. */ diff --git a/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module index 2f3ba6c..3ef9905 100644 --- a/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module +++ b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module @@ -3,8 +3,6 @@ /** * @file * Contains custom contact message functionality for ContactStorageTest. - * - * FIXME (@todo below) */ use Drupal\Core\Field\FieldDefinition; @@ -15,15 +13,11 @@ function contact_storage_test_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) { if ($entity_type->id() == 'contact_message') { $fields = array(); + $fields['id'] = FieldDefinition::create('integer') ->setLabel(t('Message ID')) ->setDescription(t('The message ID.')) ->setReadOnly(TRUE) - // Explicitly set this to 'contact' so that - // ContentEntityDatabaseStorage::usesDedicatedTable() doesn't attempt to - // put the ID in a dedicated table. - // @todo Remove when https://www.drupal.org/node/1498720 is in. - ->setProvider('contact') ->setSetting('unsigned', TRUE); return $fields;