Best place to store my service sqlite db file?
doctrine-orm, sqlite, symfony
Solution
It Shouldn't be in web folder :)
If your db can deleted as and when you clear cache, app/cache would be fine.
If you want persistent database, then you can choose somewhere in app/{name of service}/db.sqlite" or data/{name of service}/db.sqlite"
I would rather pass the name of the DB in config options
Also note that under *NIX the user of your web server/cli must have read and write permissions on the database file and read, write and execute permissions on the containing directory
Problem
I'm new to Symfony2. I'm developping a utility service that needs to use a database for its own needs. I want its data to be kept separated from the mysql global db used by others services/bundles. Where is the best place to store the db file and how to specify the path ? Sample (bad) code : ``` class MyCustomService { protected $config; public function __construct(array $config) { $this->config = $config; $this->setupDB(); } private function setupDB() { $config = new \Doctrine\DBAL\Configuration(); $connectionParams = array( 'driver' => 'pdo_sqlite', 'path' => realpath('.') . '\dbmanager.db' ); $conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config); //... } } ``` Thanks for your help