示例#1
0
 /**
  * {@inheritdoc}
  */
 public function getSlaves()
 {
     if ($this->slaves) {
         return array_values($this->slaves);
     }
     if ($this->updateSentinels) {
         $this->updateSentinels();
     }
     SENTINEL_QUERY:
     $sentinel = $this->getSentinelConnection();
     try {
         $slavesParameters = $this->querySentinelForSlaves($sentinel, $this->service);
         foreach ($slavesParameters as $slaveParameters) {
             $this->add($this->connectionFactory->create($slaveParameters));
         }
     } catch (ConnectionException $exception) {
         $this->sentinelConnection = null;
         goto SENTINEL_QUERY;
     }
     return array_values($this->slaves ?: array());
 }
 /**
  * Returns connection object.
  *
  * @return mixed
  */
 public function create()
 {
     return $this->factory->create();
 }