By mikelutz on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.8.x
Introduced in version:
8.8.0
Issue links:
Description:
entity_delete_multiple is deprecated and will officially trigger an error in 8.8.0
Use the entity storage's delete() method to delete multiple entities:
Before:
entity_delete_multiple($entity_type, $ids)
Now:
$storage_handler = \Drupal::entityTypeManager()->getStorage($entity_type);
$entities = $storage_handler->loadMultiple($ids);
$storage_handler->delete($entities);
Comments
Performance
It's actually needed to load all entities from database just to delete they?
Perhaps it's due the access checks, but what about if what I want to accomplish is to delete entities in a cron job? Is there any other way without to use database commands?