public function getConnection() { if (!preg_match('/^\\//', $this->dataDir)) { // resolve relative path to data dir $this->dataDir = Application::resolveRelativePath($this->dataDir); } return array('driver' => 'pdo_sqlite', 'path' => sprintf('%s/%s', $this->dataDir, $this->filename)); }
protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln(''); $output->write("Creating Portunus DB ... "); Application::createDb($this->getContainer()); $output->writeln('<info>DONE</info>'); $output->writeln(''); }
public function setUp() { if ($this->freshDb) { return; } $this->getContainer()->setParameter('doctrine.db.filename', 'portunus_test.sqlite'); $dataDir = $this->getContainer()->getParameter('doctrine.db.data_dir'); $dbFile = $this->getContainer()->getParameter('doctrine.db.filename'); $dataDir = Application::resolveRelativePath($dataDir); $dbFile = sprintf('%s/%s', $dataDir, $dbFile); if (file_exists($dbFile)) { unlink($dbFile); } $this->getContainer()->get('portunus.application')->createDb($this->getContainer()); $this->freshDb = true; }
/** * Post install event handler * * @param Event $event * @throws \Exception */ public static function postInstall(Event $event) { self::writeConfigXml($event); Application::createDb(); }