Problem/Motivation
If you try to delete an entity:
drush ed node 1 2 3 4 5
you will see this error:
[error] Error: Call to undefined function node_delete_multiple() in _drush_entity_delete_node() (line 1026 of /Users/adriancid/.drush/drush_entity/entity.drush.inc) #0 /Users/adriancid/.drush/drush_entity/entity.drush.inc(1002): _drush_entity_delete_node(Array)
#1 /Users/adriancid/.drush/drush_entity/entity.drush.inc(871): _drush_entity_delete('node', Array)
#2 /Users/adriancid/drush/includes/command.inc(367): drush_entity_delete('node', Array, '2', '3', '4', '5')
#3 /Users/adriancid/drush/includes/command.inc(218): _drush_invoke_hooks(Array, Array)
#4 /Users/adriancid/drush/includes/command.inc(186): drush_command('node', '1', '2', '3', '4', '5')
#5 /Users/adriancid/drush/lib/Drush/Boot/BaseBoot.php(73): drush_dispatch(Array)
#6 /Users/adriancid/drush/includes/preflight.inc(89): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#7 /Users/adriancid/drush/drush.php(11): drush_main()
#8 {main}.
Error: Call to undefined function node_delete_multiple() in _drush_entity_delete_node() (line 1026 of /Users/adriancid/.drush/drush_entity/entity.drush.inc).
[error] Drush command terminated abnormally due to an unrecoverable error. Proposed resolution
The code need an update to the new Drupal 8 API functions.
Read more at:
https://api.drupal.org/api/drupal/core!includes!entity.inc/function/enti...
And as entity_delete_multiple() will be deprecated in Drupal 9, we need to use the EntityStorageInterface::delete https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
See a working example in:
How to delete all nodes of a given content type programmatically?
Remaining tasks
Update the functions to Drupal 8 API.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments