Upfront, let me say that I am not using PHQL for this application.
I am trying to understand how to access the db connection in a model within an app that is using FactoryDefault for DI.
The code from services.php is shown below.
/**
* Database connection is created based in the parameters defined in the configuration file
*/
$di->set('db', function() use ($config) {
$dbclass = 'Phalcon\Db\Adapter\Pdo\\' . $config->database->adapter;
return new $dbclass(array(
"host" => $config->database->host,
"username" => $config->database->username,
"password" => $config->database->password,
"dbname" => $config->database->name
));
});