【发布时间】:2016-04-08 04:16:54
【问题描述】:
我需要在 Drupal 8 中删除所有相同类型的节点(节点数量超过 7k)。
这对 Drupal 7 来说不是问题(数据库查询 + node_delete 或 node_delete_multiple 可以解决我的问题)。但是,D8 略有不同:)
请指教,我该怎么做。提前致谢!
【问题讨论】:
-
这是 drupal.stackexchange.com/q/537/3167 的副本 Drupal 8 的最佳答案是 drupal.stackexchange.com/a/224226/3167
$storage_handler = \Drupal::entityTypeManager()->getStorage("node"); $entities = $storage_handler->loadByProperties(["type" => "YOUR_CONTENT_TYPE_NAME"]); $storage_handler->delete($entities);
标签: drupal-8