Example #1
0
 /**
  * Setup the adapters needed.  An adapter must be defined for each database connection.
  * Generally the adapter will be the same as the PEAR phpname; e.g. for MySQL, use the
  * 'mysql' adapter.
  * @param      array $configuration the Configuration representing the properties file
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 private static function initAdapters($configuration)
 {
     self::$adapterMap = array();
     $c = isset($configuration['datasources']) ? $configuration['datasources'] : null;
     if (!empty($c)) {
         try {
             foreach ($c as $handle => $properties) {
                 if (is_array($properties) && isset($properties['adapter'])) {
                     $db = DBAdapter::factory($properties['adapter']);
                     // register the adapter for this name
                     self::$adapterMap[$handle] = $db;
                 }
             }
         } catch (Exception $e) {
             throw new PropelException("Unable to initialize adapters.", $e);
         }
     } else {
         self::log("There were no adapters in the configuration.", self::LOG_WARNING);
     }
 }