How can I uninstall a Drupal 8 module with entities in the db?
I have made a dev module that implement content entities created using the drupal console. I've added fields, views, and made some modifications. But, when I try to uninstall the module, there is a error:
The following reasons prevent the modules from being uninstalled: There is content for the entity type: xxx
Where xxx is the entity type name. If I delete the entities manually or via code, I can disable the module. But I wanted a easier way, allowing the module to delete the entities itself. I tried using hook_uninstall(), but apparently it is called after the triggering error.
I did't found the answer googling. Maybe my wording was wrong...
Anyaway. Any help would be apreciated