protected function parseSqliteOptions(array $config)
{
if (isset($config['memory']) && $config['memory']) {
// If in-memory, no need to parse paths
unset($config['path']);
return $config;
} else {
// Prevent SQLite driver from trying to use in-memory connection
unset($config['memory']);
}
// Get path from config or use database path
if (isset($config['path'])) {
$path = $this->app['pathmanager']->create($config['path']);
// If path is relative, resolve against root path
if ($path instanceof RelativePathInterface) {
$path = $path->resolveAgainst($this->app['resources']->getPathObject('root'));
}
} else {
$path = $this->app['resources']->getPathObject('database');
}
// If path has filename with extension, use that
if ($path->hasExtension()) {
$config['path'] = $path->string();
return $config;
}
// Use database name for filename
/** @var PathInterface $filename */
$filename = $this->app['pathmanager']->create(basename($config['dbname']));
if (!$filename->hasExtension()) {
$filename = $filename->joinExtensions('db');
}
// Join filename with database path
$config['path'] = $path->joinAtoms($filename)->string();
return $config;
}