I am attempting to set-up multiple connections in my li3 project but when I do I get an uncaught exception. I set my connections in the app/confi/bootstrap/connections.php file which is then loaded in by the bootstrap.php file. Here is what I have for my connections:
Connections::add('default', array(
'development' => array(
'type' => 'MongoDb',
'host' => 'localhost',
'database' => 'web_app'
),
'test' => array(
'type' => 'MongoDb',
'host' => 'localhost',
'database' => 'test_web_app'
)
)
);
When I have it set like this and try to browse to my project I get this error:
Fatal error: Uncaught exception 'lithium\core\ConfigException' with message 'No adapter set for configuration in class `lithium\data\Connections`.' in /var/www/site/libraries/lithium/core/Adaptable.php:233
However when I just have a single default connection set-up it works fine. Has anyone else ran into this issue?
--UPDATE-- I went looking through the stack trace from the exception and found the issue is caused by a filter I set-up in my file app/config/bootstrap/user.php which is then loaded by bootstrap.php
Here is what my user.php file looks like:
use app\models\Users;
use lithium\security\Password;
Users::applyFilter('save', function($self, $params, $chain) {
if ($params['data']) {
$params['entity']->set($params['data']);
$params['data'] = array();
}
if (!$params['entity']->exists()) {
$params['entity']->password = Password::hash($params['entity']->password);
}
return $chain->next($self, $params, $chain);
});
According to the stack trace the error is coming from line 21 of this file. The only thing on line 21 is }); so I am still not certain why this is causing an error.