diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php index bd52b04..87904de 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php @@ -646,7 +646,7 @@ protected function mapFromStorageRecords(array $records, $load_from_revision = F $translations = array_fill_keys(array_keys($values), array()); // Load values from shared and dedicated tables. - $this->loadFromDataTables($values, $translations); + $this->loadFromSharedTables($values, $translations); $this->loadFromDedicatedTables($values, $load_from_revision); $entities = array(); @@ -667,7 +667,7 @@ protected function mapFromStorageRecords(array $records, $load_from_revision = F * @param array &$translations * List of translations, keyed on the entity ID. */ - protected function loadFromDataTables(array &$values, array &$translations) { + protected function loadFromSharedTables(array &$values, array &$translations) { if ($this->dataTable) { // If a revision table is available, we need all the properties of the // latest revision. Otherwise we fall back to the data table. @@ -762,7 +762,7 @@ public function deleteRevision($revision_id) { ->condition($this->revisionKey, $revision->getRevisionId()) ->execute(); $this->invokeFieldMethod('deleteRevision', $revision); - $this->deleteFieldItemsRevision($revision); + $this->deleteRevisionFromDedicatedTables($revision); $this->invokeHook('revision_delete', $revision); } } @@ -909,7 +909,7 @@ protected function doDelete($entities) { foreach ($entities as $entity) { $this->invokeFieldMethod('delete', $entity); - $this->deleteFieldItems($entity); + $this->deleteFromDedicatedTables($entity); } } @@ -961,10 +961,10 @@ protected function doSave($id, EntityInterface $entity) { $entity->{$this->revisionKey}->value = $this->saveRevision($entity); } if ($this->dataTable) { - $this->savePropertyData($entity); + $this->saveToSharedTables($entity); } if ($this->revisionDataTable) { - $this->savePropertyData($entity, $this->revisionDataTable); + $this->saveToSharedTables($entity, $this->revisionDataTable); } if ($this->revisionTable) { $entity->setNewRevision(FALSE); @@ -991,10 +991,10 @@ protected function doSave($id, EntityInterface $entity) { $record->{$this->revisionKey} = $this->saveRevision($entity); } if ($this->dataTable) { - $this->savePropertyData($entity); + $this->saveToSharedTables($entity); } if ($this->revisionDataTable) { - $this->savePropertyData($entity, $this->revisionDataTable); + $this->saveToSharedTables($entity, $this->revisionDataTable); } $entity->enforceIsNew(FALSE); @@ -1003,7 +1003,7 @@ protected function doSave($id, EntityInterface $entity) { } } $this->invokeFieldMethod($is_new ? 'insert' : 'update', $entity); - $this->saveFieldItems($entity, !$is_new); + $this->saveToDedicatedTables($entity, !$is_new); if (!$is_new && $this->dataTable) { $this->invokeTranslationHooks($entity); @@ -1019,14 +1019,14 @@ protected function has($id, EntityInterface $entity) { } /** - * Stores the entity property language-aware data. + * Saves fields that use the shared tables. * - * @param \Drupal\Core\Entity\EntityInterface $entity + * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The entity object. * @param string $table_name * (optional) The table name to save to. Defaults to the data table. */ - protected function savePropertyData(EntityInterface $entity, $table_name = NULL) { + protected function saveToSharedTables(ContentEntityInterface $entity, $table_name = NULL) { if (!isset($table_name)) { $table_name = $this->dataTable; } @@ -1164,13 +1164,13 @@ protected function mapToDataStorageRecord(EntityInterface $entity, $table_name = /** * Saves an entity revision. * - * @param \Drupal\Core\Entity\EntityInterface $entity + * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The entity object. * * @return int * The revision id. */ - protected function saveRevision(EntityInterface $entity) { + protected function saveRevision(ContentEntityInterface $entity) { $record = $this->mapToStorageRecord($entity, $this->revisionTable); $entity->preSaveRevision($this, $record); @@ -1305,14 +1305,14 @@ protected function loadFromDedicatedTables(array &$values, $load_from_revision) } /** - * Saves values of configurable fields for an entity. + * Saves values of fields that use dedicated tables. * - * @param \Drupal\Core\Entity\EntityInterface $entity + * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The entity. * @param bool $update * TRUE if the entity is being updated, FALSE if it is being inserted. */ - protected function saveFieldItems(EntityInterface $entity, $update = TRUE) { + protected function saveToDedicatedTables(ContentEntityInterface $entity, $update = TRUE) { $vid = $entity->getRevisionId(); $id = $entity->id(); $bundle = $entity->bundle(); @@ -1407,12 +1407,12 @@ protected function saveFieldItems(EntityInterface $entity, $update = TRUE) { } /** - * Deletes values of configurable fields for all revisions of an entity. + * Deletes values of fields in dedicated tables for all revisions. * - * @param \Drupal\Core\Entity\EntityInterface $entity + * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The entity. */ - protected function deleteFieldItems(EntityInterface $entity) { + protected function deleteFromDedicatedTables(ContentEntityInterface $entity) { $table_mapping = $this->getTableMapping(); foreach ($this->entityManager->getFieldDefinitions($entity->getEntityTypeId(), $entity->bundle()) as $field_definition) { $storage_definition = $field_definition->getFieldStorageDefinition(); @@ -1433,12 +1433,12 @@ protected function deleteFieldItems(EntityInterface $entity) { } /** - * Deletes values of configurable fields for a single revision of an entity. + * Deletes values of fields in dedicated tables for all revisions. * - * @param \Drupal\Core\Entity\EntityInterface $entity + * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The entity. It must have a revision ID. */ - protected function deleteFieldItemsRevision(EntityInterface $entity) { + protected function deleteRevisionFromDedicatedTables(ContentEntityInterface $entity) { $vid = $entity->getRevisionId(); if (isset($vid)) { $table_mapping = $this->getTableMapping();