Try a setup similar to this:
app.ini (adapt if you're using the array driver)
[database]
connection.host =
connection.username =
connection.password =
connection.dbname = /path/to/app/cache/data/dev_db
adapter = Phalcon\Db\Adapter\Pdo\Sqlite
metaCache = Memory
metaCacheOptions.lifetime = 86400
metaCacheOptions.prefix = metaCache
metaCacheOptions.metaDataDir = ../app/cache/metadata/
charset = "utf8"
prefix = my_table_prefix
DB service:
$di->set('db', function() use ($config, $eventsManager) {
try {
$dbConnectionConfig = $config->database->connection->toArray();
$dbclass = new $config->database->adapter($dbConnectionConfig);
$dbclass->setEventsManager($eventsManager);
} catch (\Exception $e) {
// return a 500 error page would be nicer
die('db connection failed.');
}
return $dbclass;
});
BaseModel:
<?php
class ModelBase extends \Phalcon\Mvc\Model {
/**
*
* @return string
*/
public function getSource()
{
$name = (!empty($this->getDI()->getConfig()->database->prefix)) ? $this->getDI()->getConfig()->database->prefix . '_' : '';
return $name . parent::getSource();
}
}
Users:
class Users extends \BaseModel
{
}
Hope this helps, set prefix in your config to blank if you want to disable. Basically managing the prefix separately instead of passing through to the driver setup.
If not could you post a bit more about your current setup?