예제 #1
0
 /**
  * Constructor
  */
 public function __construct()
 {
     // Load connection configuration data
     if (!($db = Config::getInstance()->get('db'))) {
         throw new \Exception('Configuration is missed!');
     }
     $this->db = new Database($db);
 }
예제 #2
0
 /**
  * Pre-initializes the application
  * @throws \Exception
  */
 public function preInit()
 {
     // Load configuration data
     if (!($config = Config::getInstance()->get())) {
         throw new \Exception('Configuration is missed!');
     }
     /** if (!isset($config['basePath']) || empty($config['basePath'])) {
             throw new \Exception('The "basePath" is required.');
         } else {
             $this->setBasePath($config['basePath']);
             unset($config['basePath']);
         } */
     $this->setBasePath($config['basePath']);
     if (isset($config['defaultController']) && !empty($config['defaultController'])) {
         $this->setDefaultController($config['defaultController']);
         unset($config['defaultController']);
     }
     if (isset($config['defaultAction']) && !empty($config['defaultAction'])) {
         $this->setDefaultAction($config['defaultAction']);
         unset($config['defaultAction']);
     }
 }