Same name in this branch
- 10 core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::ensureTableExists()
- 10 core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::ensureTableExists()
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::ensureTableExists()
Check if the table exists and create it if not.
Return value
bool TRUE if the table exists, FALSE if it does not exists.
2 calls to DatabaseStorage::ensureTableExists()
- DatabaseStorage::set in core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php - Saves a value for a given key.
- DatabaseStorage::setIfNotExists in core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php - Saves a value for a given key if it does not exist yet.
File
- core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorage.php, line 255
Class
- DatabaseStorage
- Defines a default key/value store implementation.
Namespace
Drupal\Core\KeyValueStoreCode
protected function ensureTableExists() {
try {
$database_schema = $this->connection
->schema();
$database_schema
->createTable($this->table, $this
->schemaDefinition());
} catch (DatabaseException $e) {
} catch (\Exception $e) {
return FALSE;
}
return TRUE;
}