更新时间:2023-02-11 14:25:58
一个人应该使用实体查询而不是直接对数据库进行操作:
One should use entity queries instead of acting directly on the database:
$result = \Drupal::entityQuery('node')
->condition('type', 'my_content_type_name')
->execute();
entity_delete_multiple('node', $result);
像其他答案中那样设置范围应该不太困难。
Setting up ranges like in the other answer shouldn't be too difficult.
有关详细信息,请参见 EntityFieldQuery已被重写。
See EntityFieldQuery has been rewritten for more information.