Skip to main content
Highlighted code
Source Link
leymannx
  • 18.8k
  • 6
  • 72
  • 126

Is there's a better way to update a node than directly changing the database table?

Yes, use the node_load()node_load() and node_save()node_save() functions as these take care of everything for you including the cache.

Changing the values directly in the database is not advised as any number of modules could have additional handlers added which will not be picked up by altering the database directly.

EDIT: For Drupal 8 use $node = \Drupal\node\Entity\Node::load() instead, then just $node->save()

Is there's a better way to update a node than directly changing the database table?

Yes, use the node_load() and node_save() functions as these take care of everything for you including the cache.

Changing the values directly in the database is not advised as any number of modules could have additional handlers added which will not be picked up by altering the database directly.

EDIT: For Drupal 8 use $node = \Drupal\node\Entity\Node::load() instead, then just $node->save()

Is there's a better way to update a node than directly changing the database table?

Yes, use the node_load() and node_save() functions as these take care of everything for you including the cache.

Changing the values directly in the database is not advised as any number of modules could have additional handlers added which will not be picked up by altering the database directly.

EDIT: For Drupal 8 use $node = \Drupal\node\Entity\Node::load() instead, then just $node->save()

Rollback to Revision 3
Source Link
Colin Shipton
  • 2.5k
  • 1
  • 17
  • 26

Is there's a better way to update a node than directly changing the database table?

Drupal 7

Yes, use the node_load()node_load() and node_save()node_save() functions as these take care of everything for you including the cache.

Changing the values directly in the database is not advised as any number of modules could have additional handlers added which will not be picked up by altering the database directly.

Drupal 8

EDIT: For Drupal 8 use $node = \Drupal\node\Entity\Node::load() instead, then just $node->save()

Is there's a better way to update a node than directly changing the database table?

Drupal 7

Yes, use the node_load() and node_save() functions as these take care of everything for you including the cache.

Changing the values directly in the database is not advised as any number of modules could have additional handlers added which will not be picked up by altering the database directly.

Drupal 8

For Drupal 8 use $node = \Drupal\node\Entity\Node::load() instead, then just $node->save()

Is there's a better way to update a node than directly changing the database table?

Yes, use the node_load() and node_save() functions as these take care of everything for you including the cache.

Changing the values directly in the database is not advised as any number of modules could have additional handlers added which will not be picked up by altering the database directly.

EDIT: For Drupal 8 use $node = \Drupal\node\Entity\Node::load() instead, then just $node->save()

added 4 characters in body
Source Link
leymannx
  • 18.8k
  • 6
  • 72
  • 126

Is there's a better way to update a node than directly changing the database table?

Drupal 7

Yes, use the node_load()node_load() and node_save()node_save() functions as these take care of everything for you including the cache.

Changing the values directly in the database is not advised as any number of modules could have additional handlers added which will not be picked up by altering the database directly.

Drupal 8

For Drupal 8 use $node = \Drupal\node\Entity\Node::load() instead, then just $node->save()

Is there's a better way to update a node than directly changing the database table?

Drupal 7

Yes, use the node_load() and node_save() functions as these take care of everything for you including the cache.

Changing the values directly in the database is not advised as any number of modules could have additional handlers added which will not be picked up by altering the database directly.

Drupal 8

For Drupal 8 use $node = \Drupal\node\Entity\Node::load() instead, then just $node->save()

Is there's a better way to update a node than directly changing the database table?

Drupal 7

Yes, use the node_load() and node_save() functions as these take care of everything for you including the cache.

Changing the values directly in the database is not advised as any number of modules could have additional handlers added which will not be picked up by altering the database directly.

Drupal 8

For Drupal 8 use $node = \Drupal\node\Entity\Node::load() instead, then just $node->save()

added 26 characters in body
Source Link
leymannx
  • 18.8k
  • 6
  • 72
  • 126
Loading
added 105 characters in body
Source Link
Colin Shipton
  • 2.5k
  • 1
  • 17
  • 26
Loading
added 92 characters in body
Source Link
No Sssweat
  • 31.6k
  • 14
  • 55
  • 91
Loading
Source Link
Colin Shipton
  • 2.5k
  • 1
  • 17
  • 26
Loading