framework/db/Connection.php
public function getSlavePdo($fallbackToMaster = true)
    {
        $db = $this->getSlave(false);
        if ($db === null) {
            return $fallbackToMaster ? $this->getMasterPdo() : null;
        }

        return $db->pdo;
    }
public function getSlavePdo($fallbackToMaster = true)
    {
        $db = $this->getSlave(false);
        if ($db === null) {
            return $fallbackToMaster ? $this->getMasterPdo() : null;
        }

        return $db->pdo;
    }
Returns the PDO instance for the currently active slave connection.
When [[enableSlaves]] is true, one of the slaves will be used for read queries, and its PDO instance
will be returned by this method.
@param bool $fallbackToMaster whether to return a master PDO in case none of the slave connections is available.
@return PDO the PDO instance for the currently active slave connection. `null` is returned if no slave connection
is available and `$fallbackToMaster` is false.