Ejemplo n.º 1
0
 function __construct($config)
 {
     $this->config = $config;
     //Setup database connection
     $this->db = \Doctrine\DBAL\DriverManager::getConnection((array) $config->db, new \Doctrine\DBAL\Configuration());
     //Add some db debugging if in a dev enviroment
     if (APPLICATION_ENVIRONMENT === 'dev') {
         $this->logger = new \Doctrine\DBAL\Logging\DebugStack();
         $this->db->getConfiguration()->setSQLLogger($this->logger);
     }
     //Init twig
     $loader = new \Twig_Loader_Filesystem(APPLICATION_PATH_APP . '/Views');
     $this->twig = new \Twig_Environment($loader, ['cache' => APPLICATION_PATH . 'tmp/', 'debug' => APPLICATION_ENVIRONMENT === 'dev' ? true : false]);
     //Add some vars
     $this->addVar('version', VERSION);
     $this->addVar('offical_page', OFFICIAL_PAGE_URL);
 }