コード例 #1
0
 /**
  * Get cache.
  *
  * @return Cache
  */
 public function getCache()
 {
     if (null === $this->cache) {
         $directory = $this->config->getCacheDirectory();
         if (null === $directory) {
             $this->cache = new ArrayCache();
             return $this->cache;
         }
         $this->cache = new FilesystemCache($directory);
     }
     return $this->cache;
 }
コード例 #2
0
 /**
  * Get handlers.
  *
  * @return HandlerInterface[]
  */
 public function getHandlers()
 {
     if (null === $this->handlers) {
         $handlers = [];
         $path = $this->config->getLogFilePath();
         if (null !== $path) {
             $handlers[] = new StreamHandler($path);
         }
         $this->handlers = $handlers;
     }
     return $this->handlers;
 }
コード例 #3
0
ファイル: ConfigTest.php プロジェクト: gravitymedia/commander
 /**
  * Test that the expected custom values are returned.
  */
 public function testCustomConfigValues()
 {
     $config = new Config();
     $config->setDatabaseFilePath('/path/to/database.file');
     $config->setCacheDirectory('/cache/directory');
     $config->setLogFilePath('/path/to/log.file');
     $config->setProcessTimeout(Config::DEFAULT_PROCESS_TIMEOUT + 10);
     $this->assertSame('/path/to/database.file', $config->getDatabaseFilePath());
     $this->assertSame('/cache/directory', $config->getCacheDirectory());
     $this->assertSame('/path/to/log.file', $config->getLogFilePath());
     $this->assertSame(Config::DEFAULT_PROCESS_TIMEOUT + 10, $config->getProcessTimeout());
 }
コード例 #4
0
 /**
  * Get connection.
  *
  * @return Connection
  */
 public function getConnection()
 {
     if (null === $this->connection) {
         $params = ['driver' => 'pdo_sqlite', 'path' => $this->config->getDatabaseFilePath()];
         $config = $this->getEntityManagerConfig();
         $eventManager = $this->getEventManager();
         $this->connection = DriverManager::getConnection($params, $config, $eventManager);
     }
     return $this->connection;
 }