function EntityLastInstalledSchemaRepository::deleteLastInstalledDefinition

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityLastInstalledSchemaRepository.php \Drupal\Core\Entity\EntityLastInstalledSchemaRepository::deleteLastInstalledDefinition()
  2. 10 core/lib/Drupal/Core/Entity/EntityLastInstalledSchemaRepository.php \Drupal\Core\Entity\EntityLastInstalledSchemaRepository::deleteLastInstalledDefinition()
  3. 11.x core/lib/Drupal/Core/Entity/EntityLastInstalledSchemaRepository.php \Drupal\Core\Entity\EntityLastInstalledSchemaRepository::deleteLastInstalledDefinition()

Overrides EntityLastInstalledSchemaRepositoryInterface::deleteLastInstalledDefinition

File

core/lib/Drupal/Core/Entity/EntityLastInstalledSchemaRepository.php, line 106

Class

EntityLastInstalledSchemaRepository
Provides a repository for installed entity definitions.

Namespace

Drupal\Core\Entity

Code

public function deleteLastInstalledDefinition($entity_type_id) {
    $this->keyValueFactory
        ->get('entity.definitions.installed')
        ->delete($entity_type_id . '.entity_type');
    // Clean up field storage definitions as well. Even if the entity type
    // isn't currently fieldable, there might be legacy definitions or an
    // empty array stored from when it was.
    $this->keyValueFactory
        ->get('entity.definitions.installed')
        ->delete($entity_type_id . '.field_storage_definitions');
    $this->cacheBackend
        ->deleteMultiple([
        'entity_type_definitions.installed',
        $entity_type_id . '.field_storage_definitions.installed',
    ]);
    $this->entityTypeDefinitions = NULL;
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.