Remove entity type without module uninstall I created entity type my_entity in my module. But now I don't need this entity anymore and I want to completely remove it without module's uninstall. I want to remove both definition and all database related tables or data. I thought about using \Drupal::entityDefinitionUpdateManager-&gt;uninstallEntityType('my_entity') in hook_update_N, but I can't use it because entity's definition will be removed. 

Could anyone help me, and give advice how to delete both definition and database data?

UPD: I created an issue on drupal.org about this https://www.drupal.org/node/2655162
The argument for entityDefinitionUpdateManager->uninstallEntityType() is an EntityTypeInterface, not a string.

Drupal stores the last known state of an entity type, you can get it like this:

$entity_update_manager = \Drupal::entityDefinitionUpdateManager();
$entity_type = $entity_update_manager-&gt;getEntityType('your_entity_type_id');
$entity_update_manager-&gt;uninstallEntityType($entity_type);


Note that this is using the enitty definitions update manager to get the entity type definition, not the runtime entity type manager.

The field definitions are also read from state and both the entity type and field definitions are purged afterwards.