function Drupal::database

Same name in other branches
  1. 9 core/lib/Drupal.php \Drupal::database()
  2. 8.9.x core/lib/Drupal.php \Drupal::database()
  3. 11.x core/lib/Drupal.php \Drupal::database()

Returns the current primary database.

Return value

\Drupal\Core\Database\Connection The current active database's master connection.

52 calls to Drupal::database()
BasicSyntaxTest::testGetFullQualifiedTableName in core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php
Tests \Drupal\Core\Database\Connection::getFullQualifiedTableName().
batch_process in core/includes/form.inc
Processes the batch.
Breadcrumb404Test::getBreadcrumbCacheEntries in core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php
Gets the breadcrumb cache entries.
callback_batch_operation in core/lib/Drupal/Core/Form/form.api.php
Perform a single batch operation.
comment_update_10100 in core/modules/comment/comment.install
Remove the year 2038 date limitation.

... See full list

File

core/lib/Drupal.php, line 324

Class

Drupal
Static Service Container wrapper.

Code

public static function database() {
    return static::getContainer()->get('database');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.