コード例 #1
0
 /**
  * Check if custom sfConfig params are loaded. If not, load them.
  * @param PropelPDO $con
  */
 public static function check($con = null)
 {
     if (!self::is_set() && self::is_ready()) {
         if (!$con && !sfProjectConfiguration::hasActive()) {
             throw new Exception('The Project configuration is not loaded.');
         } elseif (!$con) {
             $configuration = sfProjectConfiguration::getActive();
             $databaseManager = new sfDatabaseManager($configuration);
             $con = $databaseManager->getDatabase(sfConfig::get('sf_orm'))->getConnection();
             $init = $databaseManager->initialize($configuration);
         }
         try {
             $config = sfPlopConfigPeer::retrieveAll($con);
             foreach ($config as $obj) {
                 sfConfig::set(self::prefix() . $obj->getName(), sfPlopConfigPeer::load($obj->getValue()));
             }
             sfConfig::set(self::prefix(''), true);
         } catch (Exception $e) {
             return false;
         }
     }
 }