Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Drupal.php

function Drupal::database

Returns the current primary database.

Return value

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

13 calls to Drupal::database()
batch_process in core/includes/form.inc
Processes the batch.
callback_batch_operation in core/lib/Drupal/Core/Form/form.api.php
Perform a single batch operation.
DblogHooks::cron in core/modules/dblog/src/Hook/DblogHooks.php
Implements hook_cron().
hook_entity_predelete in core/lib/Drupal/Core/Entity/entity.api.php
Act before entity deletion.
hook_ENTITY_TYPE_predelete in core/lib/Drupal/Core/Entity/entity.api.php
Act before entity deletion of a particular entity type.

... 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');
}
RSS feed
Powered by Drupal