Пример #1
0
 /**
  * Constructor
  *
  * Initialize things.
  *
  */
 function __construct()
 {
     if (null == self::$_appInstance) {
         self::$_appInstance = Slim::getInstance();
     }
     Doctrine_Core::loadModels(MODELS_PATH);
     DoctrineAdapter::getInstance();
 }
Пример #2
0
 function __construct()
 {
     $manager = Doctrine_Manager::getInstance();
     $manager->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true);
     Doctrine_Core::setModelsDirectory(MODELS_PATH);
     if (!self::$_dbConnection) {
         try {
             self::$_dbConnection = Doctrine_Manager::connection(new PDO($this->_dbtype . ':host=' . $this->_host . ';port=' . $this->_port . ';dbname=' . $this->_dbName, $this->_dbUser, $this->_dbPwd, $this->_db_params));
         } catch (PDOException $e) {
             self::$_dbConnection = null;
             /* error message output */
             if ($this->_production_mode === true) {
                 file_put_contents('dortine_errors.log', $e->getMessage(), FILE_APPEND);
                 // log the errors
                 die($e->getMessage());
             } else {
                 die($e->getMessage());
             }
         }
         // end try
     }
     // end if
 }