protected MenuTreeStorage::safeExecuteSelect(SelectInterface $query)
Executes a select query while making sure the database table exists.
Parameters
\Drupal\Core\Database\Query\SelectInterface $query: The select object to be executed.
Return value
\Drupal\Core\Database\StatementInterface|null A prepared statement, or NULL if the query is not valid.
Throws
\Exception Thrown if the table could not be created or the database connection failed.
File
- core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 240
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\Menu
Code
protected function safeExecuteSelect(SelectInterface $query) { try { return $query->execute(); } catch (\Exception $e) { // If there was an exception, try to create the table. if ($this->ensureTableExists()) { return $query->execute(); } // Some other failure that we can not recover from. throw $e; } }
Please login to continue.