You are here

public static function Drupal::database in Drupal 8

Same name and namespace in other branches
  1. 9 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().
block_content_update_8400 in core/modules/block_content/block_content.install
Add a publishing status field for block_content entities.
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.
CommentUpdateTest::testCommentEntityTypeAndFieldNameRequired in core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php
Tests whether the 'entity_type' and 'field_name' columns are required.

... See full list

File

core/lib/Drupal.php, line 300
Contains \Drupal.

Class

Drupal
Static Service Container wrapper.

Code

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