/**
  * @param \Propel\Runtime\Adapter\AdapterInterface $adapter
  *
  * @return \Propel\Runtime\Connection\ConnectionInterface
  */
 public function getWriteConnection(AdapterInterface $adapter = null)
 {
     if (null === $this->connection) {
         $this->connection = ConnectionFactory::create($this->configuration, $adapter);
         $this->connection->setName($this->getName());
     }
     return $this->connection;
 }
 /**
  * Get a slave connection.
  *
  * If no slave connection exist yet, choose one configuration randomly in the
  * read configuration to open it.
  *
  * @param \Propel\Runtime\Adapter\AdapterInterface $adapter
  *
  * @return \Propel\Runtime\Connection\ConnectionInterface
  */
 public function getReadConnection(AdapterInterface $adapter = null)
 {
     if ($this->isForceMasterConnection()) {
         return $this->getWriteConnection($adapter);
     }
     if (null === $this->readConnection) {
         if (null === $this->readConfiguration) {
             $this->readConnection = $this->getWriteConnection($adapter);
         } else {
             $keys = array_keys($this->readConfiguration);
             $key = $keys[mt_rand(0, count($keys) - 1)];
             $configuration = $this->readConfiguration[$key];
             $this->readConnection = ConnectionFactory::create($configuration, $adapter);
             $this->readConnection->setName($this->getName());
         }
     }
     return $this->readConnection;
 }