protected function DatabaseStorageControllerNG::mapToRevisionStorageRecord

Maps from an entity object to the storage record of the revision table.

Parameters

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

Return value

\stdClass The record to store.

1 call to DatabaseStorageControllerNG::mapToRevisionStorageRecord()
DatabaseStorageControllerNG::saveRevision in drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
Saves an entity revision.

File

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

Class

DatabaseStorageControllerNG
Implements Field API specific enhancements to the DatabaseStorageController class.

Namespace

Drupal\Core\Entity

Code

protected function mapToRevisionStorageRecord(ComplexDataInterface $entity) {
  $record = new \stdClass();
  $definitions = $entity
    ->getPropertyDefinitions();
  foreach (drupal_schema_fields_sql($this->entityInfo['revision_table']) as $name) {
    if (isset($definitions[$name]) && isset($entity->{$name}->value)) {
      $record->{$name} = $entity->{$name}->value;
    }
  }
  return $record;
}