diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index 2daa9548b66e16e61b1ec276b3877229b7fc0647..113cc3d61cb7f6bd0a901e0c7260301c2bde8254 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -509,9 +509,18 @@ function hook_node_revision_delete(Drupal\node\Node $node) { /** * Respond to creation of a new node. * - * This hook is invoked from node_save() after the node is inserted into the - * node table in the database, after the type-specific hook_insert() is invoked, - * and after field_attach_insert() is called. + * This hook is invoked from node_save() after the database query that will + * insert the node into the node table is scheduled for execution, after the + * type-specific hook_insert() is invoked, and after field_attach_insert() is + * called. + * + * Note that when this hook is invoked, the changes have not yet been written to + * the database, because a database transaction is still in progress. The + * transaction is not finalized until the save operation is entirely completed + * and node_save() goes out of scope. You should not rely on data in the + * database at this time as it is not updated yet. You should also note that any + * write/update database queries executed from this hook are also not committed + * immediately. Check node_save() and db_transaction() for more info. * * @param Drupal\node\Node $node * The node that is being created. @@ -703,9 +712,18 @@ function hook_node_presave(Drupal\node\Node $node) { /** * Respond to updates to a node. * - * This hook is invoked from node_save() after the node is updated in the node - * table in the database, after the type-specific hook_update() is invoked, and - * after field_attach_update() is called. + * This hook is invoked from node_save() after the database query that will + * update node in the node table is scheduled for execution, after the + * type-specific hook_update() is invoked, and after field_attach_update() is + * called. + * + * Note that when this hook is invoked, the changes have not yet been written to + * the database, because a database transaction is still in progress. The + * transaction is not finalized until the save operation is entirely completed + * and node_save() goes out of scope. You should not rely on data in the + * database at this time as it is not updated yet. You should also note that any + * write/update database queries executed from this hook are also not committed + * immediately. Check node_save() and db_transaction() for more info. * * @param Drupal\node\Node $node * The node that is being updated. diff --git a/core/modules/user/user.api.php b/core/modules/user/user.api.php index 660c06b9d66677ed895f89102a0039c64d7e27bc..0c3002c994b3adb43cf9909e2b161cb0c56ec5a7 100644 --- a/core/modules/user/user.api.php +++ b/core/modules/user/user.api.php @@ -255,6 +255,14 @@ function hook_user_presave($account) { /** * Respond to creation of a new user account. * + * Note that when this hook is invoked, the changes have not yet been written to + * the database, because a database transaction is still in progress. The + * transaction is not finalized until the save operation is entirely completed + * and user_save() goes out of scope. You should not rely on data in the + * database at this time as it is not updated yet. You should also note that any + * write/update database queries executed from this hook are also not committed + * immediately. Check user_save() and db_transaction() for more info. + * * @param $account * The user account object. * @@ -273,6 +281,14 @@ function hook_user_insert($account) { /** * Respond to updates to a user account. * + * Note that when this hook is invoked, the changes have not yet been written to + * the database, because a database transaction is still in progress. The + * transaction is not finalized until the save operation is entirely completed + * and user_save() goes out of scope. You should not rely on data in the + * database at this time as it is not updated yet. You should also note that any + * write/update database queries executed from this hook are also not committed + * immediately. Check user_save() and db_transaction() for more info. + * * @param $account * The user account object. *