You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Paul ,
As you have already mentioned in irc , this is just an initial commit , you can ignore if I am also wrong :-) .
Currently in many places , some variables are never assigned . For eg: currently for getRead() , see $slaves . In constructor we are accepting and setting $slaves , $masters array.
// pick a random slave, or a random master if no slaves, or default if no masters
public function getRead()
{
if ($slaves) {
return $this->getRandomSlave();
} elseif ($masters) {
return $this->getRandomMaster();
} else {
return $this->getDefault();
}
}
So I guess the below implementation will be the correct way .
// pick a random slave, or a random master if no slaves, or default if no masters
public function getRead()
{
if (!empty($this->slaves)) {
return $this->getRandomSlave();
} elseif (!empty($this->masters)) {
return $this->getRandomMaster();
} else {
return $this->getDefault();
}
}
getRandomSlave() and getRandomSlave() are having $key which is not assigned . See below.
// converts a random $this->masters entry to a Connection object
public function getRandomSlave()
{
if (! $key) {
$key = array_rand($this->slaves);
} elseif (! isset($this->slaves[$key])) {
throw new Exception\NoSuchConnection;
}
if (! $this->conn['slaves'][$key] instanceof Connection) {
list($adapter, $params) = $this->merge($this->slaves[$key]);
$this->conn['slaves'][$key] = $this->factory->newInstance($adapter, $params);
}
return $this->conn['slaves'][$key];
}
Hi Paul ,
As you have already mentioned in irc , this is just an initial commit , you can ignore if I am also wrong :-) .
Currently in many places , some variables are never assigned . For eg: currently for getRead() , see $slaves . In constructor we are accepting and setting $slaves , $masters array.
So I guess the below implementation will be the correct way .
getRandomSlave()
andgetRandomSlave()
are having $key which is not assigned . See below.My commit is over
harikt@794181f
As told for the
getRandomSlave()
andgetRandomSlave()
, I have not made any changes . Please have a look .Thanks
The text was updated successfully, but these errors were encountered: