protected function DatabaseStorageControllerNG::savePropertyData

Stores the entity property language-aware data.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity object.

1 call to DatabaseStorageControllerNG::savePropertyData()
DatabaseStorageControllerNG::save in drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
Overrides DatabaseStorageController::save().

File

drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php, line 479
Contains \Drupal\Core\Entity\DatabaseStorageControllerNG.

Class

DatabaseStorageControllerNG
Implements Field API specific enhancements to the DatabaseStorageController class.

Namespace

Drupal\Core\Entity

Code

protected function savePropertyData(EntityInterface $entity) {

  // Delete and insert to handle removed values.
  $this->database
    ->delete($this->dataTable)
    ->condition($this->idKey, $entity
    ->id())
    ->execute();
  $query = $this->database
    ->insert($this->dataTable);
  foreach ($entity
    ->getTranslationLanguages() as $langcode => $language) {
    $record = $this
      ->mapToDataStorageRecord($entity, $langcode);
    $values = (array) $record;
    $query
      ->fields(array_keys($values))
      ->values($values);
  }
  $query
    ->execute();
}