/**
  * Configures a Propel datasource.
  *
  * @param array  $parameters The datasource parameters
  * @param string $name       The datasource name
  */
 public function initialize($parameters = null, $name = 'propel')
 {
     parent::initialize($parameters);
     if (!$this->hasParameter('datasource') && $this->hasParameter('name')) {
         $this->setParameter('datasource', $this->getParameter('name'));
     } elseif (!$this->hasParameter('datasource') && !empty($name)) {
         $this->setParameter('datasource', $name);
     }
     $this->addConfig();
     // mark the first connection as the default
     if (!Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT)->getParameter('datasources.default')) {
         $this->setDefaultConfig();
     }
     // for BC
     if ($this->getParameter('pooling', false)) {
         Propel::enableInstancePooling();
     } else {
         Propel::disableInstancePooling();
     }
 }
 /**
  * Initializes sfPropelDatabase by loading configuration and initializing Propel
  *
  * @param array $parameters The datasource parameters
  * @param string $name The datasource name
  *
  * @return void
  */
 public function initialize($parameters = null, $name = 'propel')
 {
     parent::initialize($parameters);
     if (!$this->hasParameter('datasource') && $this->hasParameter('name')) {
         $this->setParameter('datasource', $this->getParameter('name'));
     } elseif (!$this->hasParameter('datasource') && !empty($name)) {
         $this->setParameter('datasource', $name);
     }
     $this->addConfig();
     $is_default = $this->getParameter('is_default', false);
     // first defined if none listed as default
     if ($is_default || 1 == count(self::$config['propel']['datasources'])) {
         $this->setDefaultConfig();
     }
     Propel::setConfiguration(self::$config[$name]);
     if ($this->getParameter('pooling', false)) {
         Propel::enableInstancePooling();
     } else {
         Propel::disableInstancePooling();
     }
     if (!Propel::isInit()) {
         Propel::initialize();
     }
 }