Exemple #1
0
 /**
  * Initializes Propel.
  */
 protected function initPropel()
 {
     if (!file_exists($this['propel.conf'])) {
         $this->logger->notice("Propel configuration missing, skipping propel initialization.");
         return;
     }
     // Use Composer autoloader instead of the built-in propel autoloader
     \Propel::configure($this['propel.conf']);
     $config = \Propel::getConfiguration(\PropelConfiguration::TYPE_OBJECT);
     $classmap = array();
     $projectClassPath = $this['propel.projectClassPath'];
     foreach ($config['classmap'] as $className => $file) {
         $classmap[$className] = $projectClassPath . DIRECTORY_SEPARATOR . $file;
     }
     $level = error_reporting(error_reporting() & ~E_USER_WARNING);
     \Propel::initialize();
     \PropelAutoloader::getInstance()->unregister();
     $this->autoloader->addClassMap($classmap);
     error_reporting($level);
     // Initialize debugging/logging
     if ($this['propel.debug']) {
         \Propel::getConnection()->useDebug(true);
         if ($this['propel.logging']) {
             \Propel::setLogger($this->logger);
         }
     }
 }
Exemple #2
0
 /**
  * Initializes Propel.
  */
 private static function initPropel()
 {
     if (!file_exists(self::$config->curry->propel->conf)) {
         self::log("Propel configuration missing, skipping propel initialization.");
         return;
     }
     // Use Composer autoloader instead of the built-in propel autoloader
     Propel::configure(self::$config->curry->propel->conf);
     $config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
     $classmap = array();
     $projectClassPath = self::$config->curry->propel->projectClassPath;
     foreach ($config['classmap'] as $className => $file) {
         $classmap[$className] = $projectClassPath . DIRECTORY_SEPARATOR . $file;
     }
     $level = error_reporting(error_reporting() & ~E_USER_WARNING);
     Propel::initialize();
     PropelAutoloader::getInstance()->unregister();
     self::getAutoloader()->addClassMap($classmap);
     error_reporting($level);
     // Initialize debugging/logging
     if (self::$config->curry->propel->debug) {
         Propel::getConnection()->useDebug(true);
         if (self::$logger && self::$config->curry->propel->logging) {
             Propel::setLogger(self::$logger);
         }
     }
 }