6

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

1
  • 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, 2016 at 9:56

3 Answers 3

11

Drush 9+ supports deleting custom entities drush entity:delete my_custom_entity

3
  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
2
  • Thanks for you attention Dear, but this is not my question answer.
    – Yuseferi
    Aug 25, 2016 at 5:27
  • Those answers are for deleting entities. Post is about removing the entity TYPE. Which i am trying to sort out myself. I have removed every instance of it showing up in the code; but still my site WSOD saying the entity type doesnt exist.
    – liquidcms
    Nov 10, 2022 at 20:28
2

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
2
  • Not what is being asked. See my comment above.
    – liquidcms
    Nov 10, 2022 at 20:29
  • @liquidcms you realise this answer is from 2018! Perhaps you need to post a new question?
    – Duncanmoo
    Nov 15, 2022 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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