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

        if ($this->_slave === false) {
            $this->_slave = $this->openFromPool($this->slaves, $this->slaveConfig);
        }

        return $this->_slave === null && $fallbackToMaster ? $this : $this->_slave;
    }
public function getSlave($fallbackToMaster = true)
    {
        if (!$this->enableSlaves) {
            return $fallbackToMaster ? $this : null;
        }

        if ($this->_slave === false) {
            $this->_slave = $this->openFromPool($this->slaves, $this->slaveConfig);
        }

        return $this->_slave === null && $fallbackToMaster ? $this : $this->_slave;
    }
public function getSlave ( $ fallbackToMaster = true ) { if ( ! $ this -> enableSlaves ) { return $ fallbackToMaster ? $ this : null ; } if ( $ this -> _slave === false ) { $ this -> _slave = $ this -> openFromPool ( $ this -> slaves , $ this -> slaveConfig ) ; } return $ this -> _slave === null && $ fallbackToMaster ? $ this : $ this -> _slave ; }
Returns the currently active slave connection.
If this method is called for the first time, it will try to open a slave connection when [[enableSlaves]] is true.
@param bool $fallbackToMaster whether to return a master connection in case there is no slave connection available.
@return Connection the currently active slave connection. `null` is returned if there is no slave available and
`$fallbackToMaster` is false.
Returns the currently active slave connection . If this method is called for the first time it will try to open a slave connection when [[ enableSlaves ]] is true .