0

In a project, there exist about 30K nodes which some data should be changed and new value replace the old one, the code is simple like below:

$question = Node::load($id);
$question->field_is_normal->value = !in_array($question->id(), $abnormal_questions_id);
$question->save();

I use a batch process to update all nodes, but the problem I faced is that Drupal is not creating a new revision this way and it alters the node's current revision.

how can I force Drupal to create a new revision for node rather than altering current revision?

0

0

Browse other questions tagged or ask your own question.