I've create a custom entity content with Drupal console,

 drupal generate:entity:content

Now I want delete (remove) it completely, how can I achieve it with drupal console or drush ?

my drupal version is 8.1.8 and my drupal console is 1.0 beta 5

update I have serveral Entity in my module and I want to only remove one Content type, uninstalling module cause all Entity Database table dropped.

I know I can looking for entity table in database remove it and all related file manually I looking for a method with Drupal console or Drush

  • I don't think there is a delete command for entity types, you can manually delete the class file you have created using drupal generate:entity:content – otarza Aug 24 '16 at 9:56

Drush 9 supports deleting custom entities drush entity:delete my_custom_entity

  1. You can use drush genc 0 —kill –types=article but you need to install devel_generate.
  2. You can also install Drush Delete All module available for drupal 8 module link
  • Thanks for you attention Dear, but this is not my question answer. – Yuseferi Aug 25 '16 at 5:27

Delete all custom entities of a type:

Using Drupal Console (best method):

drupal entity:delete custom_type --all

Download and install Drush Delete All module and do:

drush delete-all-entity custom_type

which is the same as drush dae custom_type

Delete all nodes of a type:

Option 1: Using Drupal Console (best method):

drupal entity:delete node --all

Option 1: Download devel module and install devel_generate submodule You can then use drush (as per @shreya's answer) or the UI:

drush genc 0 —kill –types=article 

Option 2: Download and install Drush Delete All module and do:

drush delete-all article

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.