-
-
Save algotrader-dotcom/1db77c90d44a928bb34e736ec80fd91e to your computer and use it in GitHub Desktop.
Update drupal 8 node and save
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Drupal\node\Entity\Node; | |
function _svv_tools_set_author() { | |
$user = user_load_by_name('test'); | |
$query = \Drupal::entityQuery('node'); | |
$nids = $query->execute(); | |
dd($nids); | |
foreach ($nids as $nid) { | |
$node = Node::load($nid); | |
$node->uid->value = $user->id(); | |
$node->save(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment