Hi janisbizkovski. How could I get the connection from DI?. In services.php I have all the code for connection object
$di->setShared('db', function () {
$config = $this->getConfig();
$class = 'Phalcon\Db\Adapter\Pdo\\' . $config->database->adapter;
$params = [
'host' => $config->database->host,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->dbname,
'charset' => $config->database->charset
];
if ($config->database->adapter == 'Postgresql') {
unset($params['charset']);
}
$connection = new $class($params);
return $connection;
});