diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php index d09ecfd..997b01b 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php @@ -1139,7 +1139,7 @@ protected function doDeleteFieldItemsRevision(EntityInterface $entity) { protected function usesDedicatedTable(FieldStorageDefinitionInterface $definition) { // Everything that is not provided by the entity type is stored in a // dedicated table. - return $definition->getProvider() != $this->entityType->getProvider(); + return $definition->getProvider() != $this->entityType->getProvider() && !$definition->hasCustomStorage(); } /** diff --git a/core/lib/Drupal/Core/Field/FieldDefinition.php b/core/lib/Drupal/Core/Field/FieldDefinition.php index 6eadbda..a617a04 100644 --- a/core/lib/Drupal/Core/Field/FieldDefinition.php +++ b/core/lib/Drupal/Core/Field/FieldDefinition.php @@ -545,7 +545,7 @@ public static function getReservedColumns() { * {@inheritdoc} */ public function hasCustomStorage() { - return !empty($this->definition['custom_storage']); + return !empty($this->definition['custom_storage']) || $this->isComputed(); } /** @@ -556,8 +556,14 @@ public function hasCustomStorage() { * TRUE otherwise. * * @return $this + * + * @throws \LogicException + * Thrown if custom storage is to be set to FALSE for a computed field. */ public function setCustomStorage($custom_storage) { + if (!$custom_storage && $this->isComputed()) { + throw new \LogicException("Entity storage cannot store a computed field."); + } $this->definition['custom_storage'] = $custom_storage; return $this; } diff --git a/core/modules/path/path.module b/core/modules/path/path.module index 1e089ac..be9f2c2 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -87,7 +87,8 @@ function path_entity_base_field_info(EntityTypeInterface $entity_type) { 'type' => 'path', 'weight' => 30, )) - ->setDisplayConfigurable('form', TRUE); + ->setDisplayConfigurable('form', TRUE) + ->setCustomStorage(TRUE); return $fields; }