Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
 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('');
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 /**
  * Post install event handler
  *
  * @param Event $event
  * @throws \Exception
  */
 public static function postInstall(Event $event)
 {
     self::writeConfigXml($event);
     Application::createDb();
 }