私はSymfony2が初めてです。独自のニーズに合わせてデータベースを使用する必要があるユーティリティ サービスを開発しています。
そのデータを、他のサービス/バンドルで使用される mysql グローバル データベースから分離しておきたいです。
db ファイルを保存するのに最適な場所とパスの指定方法を教えてください。
サンプル (悪い) コード:
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);
//...
}
}
ご協力いただきありがとうございます