You are here

protected function MultiversionStorageSchemaConverter::getFieldsToUpdate in Multiversion 8.2

Helper that returns the fields that need to be revisionable for the current entity type.

Return value

array

1 call to MultiversionStorageSchemaConverter::getFieldsToUpdate()
MultiversionStorageSchemaConverter::convertToMultiversionable in src/Entity/Storage/Sql/MultiversionStorageSchemaConverter.php

File

src/Entity/Storage/Sql/MultiversionStorageSchemaConverter.php, line 741

Class

MultiversionStorageSchemaConverter

Namespace

Drupal\multiversion\Entity\Storage\Sql

Code

protected function getFieldsToUpdate() {
  $base_field_definitions = $this->entityFieldManager
    ->getBaseFieldDefinitions($this->entityTypeId);
  $entity_type = $this->entityDefinitionUpdateManager
    ->getEntityType($this->entityTypeId);
  $exclude_fields = [
    $entity_type
      ->getKey('id'),
    $entity_type
      ->getKey('revision') ?: 'revision_id',
    $entity_type
      ->getKey('uuid'),
    $entity_type
      ->getKey('bundle'),
    '_deleted',
    '_rev',
  ];
  $fields_to_update = [];
  foreach ($base_field_definitions as $key => $field) {
    if (!in_array($key, $exclude_fields)) {
      $fields_to_update[] = $key;
    }
  }
  return $fields_to_update;
}