1.20.x config_database_storage.inc | public ConfigDatabaseStorage::exists($name) |
Returns whether a configuration object exists.
Parameters
string $name: The name of a configuration object to test.
Return value
bool: TRUE if the configuration object exists, FALSE otherwise.
Overrides ConfigStorageInterface::exists
File
- drivers/
config_database/ config_database_storage.inc, line 145
Class
- ConfigDatabaseStorage
- Defines the database storage controller.
Code
public function exists($name) {
try {
$query = db_select($this->table, 'c', array('target' => $this->database))
->condition('c.name', $name);
$query->addExpression('1');
$value = $query->execute()
->fetchField();
}
catch (\Exception $e) {
// Happens where there is no database. Return FALSE
$value = FALSE;
}
return $value ? TRUE : FALSE;
}