public getSlavePdo ( boolean $fallbackToMaster = true ) : PDO | ||
$fallbackToMaster | boolean | whether to return a master PDO in case none of the slave connections is available. |
Résultat | PDO | the PDO instance for the currently active slave connection. Null is returned if no slave connection is available and `$fallbackToMaster` is false. |
public function getSlavePdo($fallbackToMaster = true)
{
$db = $this->getSlave(false);
if ($db === null) {
return $fallbackToMaster ? $this->getMasterPdo() : null;
} else {
return $db->pdo;
}
}