src/Connection/Replication/MasterSlaveReplication.php
public function getConnectionByCommand(CommandInterface $command)
    {
        if (!$this->current) {
            if ($this->strategy->isReadOperation($command) && $slave = $this->pickSlave()) {
                $this->current = $slave;
            } else {
                $this->current = $this->getMasterOrDie();
            }

            return $this->current;
        }

        if ($this->current === $master = $this->getMasterOrDie()) {
            return $master;
        }

        if (!$this->strategy->isReadOperation($command) || !$this->slaves) {
            $this->current = $master;
        }

        return $this->current;
    }
public function getConnectionByCommand(CommandInterface $command)
    {
        if (!$this->current) {
            if ($this->strategy->isReadOperation($command) && $slave = $this->pickSlave()) {
                $this->current = $slave;
            } else {
                $this->current = $this->getMasterOrDie();
            }

            return $this->current;
        }

        if ($this->current === $master = $this->getMasterOrDie()) {
            return $master;
        }

        if (!$this->strategy->isReadOperation($command) || !$this->slaves) {
            $this->current = $master;
        }

        return $this->current;
    }
public function getConnectionByCommand ( CommandInterface $ command ) { if ( ! $ this -> current ) { if ( $ this -> strategy -> isReadOperation ( $ command ) && $ slave = $ this -> pickSlave ( ) ) { $ this -> current = $ slave ; } else { $ this -> current = $ this -> getMasterOrDie ( ) ; } return $ this -> current ; } if ( $ this -> current === $ master = $ this -> getMasterOrDie ( ) ) { return $ master ; } if ( ! $ this -> strategy -> isReadOperation ( $ command ) || ! $ this -> slaves ) { $ this -> current = $ master ; } return $ this -> current ; }
{@inheritdoc}
{