You are here

public function TestRevisionMetadataBcLayerEntityType::__construct in Drupal 8

Constructs a new EntityType.

Parameters

array $definition: An array of values from the annotation.

Throws

\Drupal\Core\Entity\Exception\EntityTypeIdLengthException Thrown when attempting to instantiate an entity type with too long ID.

Overrides ContentEntityType::__construct

File

core/modules/system/tests/src/Functional/Entity/Update/MoveRevisionMetadataFieldsUpdateTest.php, line 278

Class

TestRevisionMetadataBcLayerEntityType
Test entity type class for adding new required revision metadata keys.

Namespace

Drupal\Tests\system\Functional\Entity\Update

Code

public function __construct($definition) {

  // Only new instances should provide the required revision metadata keys.
  // The cached instances should return only what already has been stored
  // under the property $revision_metadata_keys. The BC layer in
  // ::getRevisionMetadataKeys() has to detect if the revision metadata keys
  // have been provided by the entity type annotation, therefore we add keys
  // to the property $requiredRevisionMetadataKeys only if those keys aren't
  // set in the entity type annotation.
  if (!isset($definition['revision_metadata_keys']['second_required_key'])) {
    $this->requiredRevisionMetadataKeys['second_required_key'] = 'second_required_key';
  }
  parent::__construct($definition);
}