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
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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.