node and i need to create
revisions for that node programmatically . When i tried as follows :
$node = Node::create([ 'nid' => $nid, //my desired node id for the revision 'type' => $bundle_type, 'field1' => value1, 'field2' => value2, ]); $node->revision = TRUE; $node->save(); $node->setPublished(true); $nid = $node->id(); print 'Created revision for node' . $nid;
Its not working , instead its creating
new nodes . Any solution for this ?