public static function Drupal::database in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal.php \Drupal::database()
 
Returns the current primary database.
Return value
\Drupal\Core\Database\Connection The current active database's master connection.
10 calls to Drupal::database()
- BasicSyntaxTest::testGetFullQualifiedTableName in core/
modules/ system/ src/ Tests/ Database/ BasicSyntaxTest.php  - Tests \Drupal\Core\Database\Connection::getFullQualifiedTableName().
 - DrupalTest::testDatabase in core/
tests/ Drupal/ Tests/ Core/ DrupalTest.php  - Tests the database() method.
 - entity_test_update_8001 in core/
modules/ system/ tests/ modules/ entity_test/ update/ entity_definition_updates_8001.inc  - Makes the 'user_id' field multiple and migrate its data.
 - entity_test_update_8002 in core/
modules/ system/ tests/ modules/ entity_test/ update/ entity_definition_updates_8002.inc  - Makes the 'user_id' field single and migrate its data.
 - MenuTreeSerializationTitleTest::testUpdate in core/
modules/ system/ src/ Tests/ Update/ MenuTreeSerializationTitleTest.php  - Ensures that the system_update_8001() runs as expected.
 
File
- core/
lib/ Drupal.php, line 282  - Contains \Drupal.
 
Class
- Drupal
 - Static Service Container wrapper.
 
Code
public static function database() {
  return static::getContainer()
    ->get('database');
}