protected function MenuTreeStorage::ensureTableExists in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::ensureTableExists()
Checks if the tree table exists and create it if not.
Return value
bool TRUE if the table was created, FALSE otherwise.
Throws
\Drupal\Component\Plugin\Exception\PluginException If a database error occurs.
1 call to MenuTreeStorage::ensureTableExists()
- MenuTreeStorage::safeExecuteSelect in core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php - Executes a select query while making sure the database table exists.
File
- core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php, line 1157 - Contains \Drupal\Core\Menu\MenuTreeStorage.
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\MenuCode
protected function ensureTableExists() {
try {
if (!$this->connection
->schema()
->tableExists($this->table)) {
$this->connection
->schema()
->createTable($this->table, static::schemaDefinition());
return TRUE;
}
} catch (SchemaObjectExistsException $e) {
// If another process has already created the config table, attempting to
// recreate it will throw an exception. In this case just catch the
// exception and do nothing.
return TRUE;
} catch (\Exception $e) {
throw new PluginException($e
->getMessage(), NULL, $e);
}
return FALSE;
}