By default, the first connection registered is the default. This can simply be accessed as you would if there was only one connection. Given the above DB registration these two lines are equal:
The first registered connection is the default and can simply be accessed as
you would if there was only one connection. Given the above configuration,
these two lines are equivalent::
$app['dbal']->fetchAssoc('SELECT * FROM table');
$app['db']->fetchAssoc('SELECT * FROM table');
$app['dbal.connection.sqlite']->fetchAssoc('SELECT * FROM table');
The default connection can be selected by setting the **default** option toggle.
$app['dbs']['mysql_read']->fetchAssoc('SELECT * FROM table');
Using multiple connections::
Using multiple connections::
$app->get('/joined/{searchOne}/{searchTwo}, function ($searchOne, $searchTwo) use ($app)) {
$app->get('/blog/show/{id}', function ($id) use ($app) {
$sqliteQuery = "SELECT * FROM table_one WHERE id = ?";