diff --git a/core/includes/database.inc b/core/includes/database.inc index 044a09b..ff03885 100644 --- a/core/includes/database.inc +++ b/core/includes/database.inc @@ -26,7 +26,7 @@ * instead. * * Do not use this function for INSERT, UPDATE, or DELETE queries. Those should - * be handled via \Drupal::database()->insert(), db_update() and db_delete() respectively. + * be handled via db_insert(), db_update() and db_delete() respectively. * * @param string|\Drupal\Core\Database\StatementInterface $query * The prepared statement query to run. Although it will accept both named and diff --git a/core/lib/Drupal/Core/Database/database.api.php b/core/lib/Drupal/Core/Database/database.api.php index 1a767b6..07e4343 100644 --- a/core/lib/Drupal/Core/Database/database.api.php +++ b/core/lib/Drupal/Core/Database/database.api.php @@ -124,11 +124,11 @@ * @section_insert INSERT, UPDATE, and DELETE queries * INSERT, UPDATE, and DELETE queries need special care in order to behave * consistently across databases; you should never use db_query() to run - * an INSERT, UPDATE, or DELETE query. Instead, use functions \Drupal::database()->insert(), + * an INSERT, UPDATE, or DELETE query. Instead, use functions db_insert(), * db_update(), and db_delete() to obtain a base query on your table, and then * add dynamic conditions (as illustrated in @ref sec_dynamic above). * - * As a note, \Drupal::database()->insert() and similar functions are wrappers on connection + * As a note, db_insert() and similar functions are wrappers on connection * object methods. In most classes, you should use dependency injection and the * database connection object instead of these wrappers; See @ref sec_connection * below for details. @@ -140,7 +140,7 @@ * You can execute it via: * @code * $fields = array('id' => 1, 'uid' => 2, 'path' => 'path', 'name' => 'Name'); - * \Drupal::database()->insert('example') + * db_insert('example') * ->fields($fields) * ->execute(); * @endcode @@ -162,7 +162,7 @@ * $txn = db_transaction(); * * try { - * $id = \Drupal::database()->insert('example') + * $id = db_insert('example') * ->fields(array( * 'field1' => 'mystring', * 'field2' => 5, diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php index d7e2f80..a31dbb9 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -947,6 +947,7 @@ function hook_entity_insert(Drupal\Core\Entity\EntityInterface $entity) { )) ->execute(); } + /** * Respond to creation of a new entity of a particular type. * @@ -969,6 +970,7 @@ function hook_ENTITY_TYPE_insert(Drupal\Core\Entity\EntityInterface $entity) { )) ->execute(); } + /** * Respond to updates to an entity. * diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index b96e010..a4937f7 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -51,7 +51,7 @@ * 'grant_update' => 0, * 'grant_delete' => 0, * ); - * \Drupal::database()->insert('node_access')->fields($record)->execute(); + * db_insert('node_access')->fields($record)->execute(); * @endcode * And then in its hook_node_grants() implementation, it would need to return: * @code diff --git a/core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php b/core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php index 7963e87..62ac59a 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php @@ -92,7 +92,7 @@ public function testCacheContext() { 'grant_update' => 0, 'grant_delete' => 0, ); - db_insert('node_access')->fields($record)->execute(); + \Drupal::database()->insert('node_access')->fields($record)->execute(); // Put user accessUser (uid 0) in the realm. \Drupal::state()->set('node_access_test.no_access_uid', 0);