public function fetchAll($sql, $bind = [], $fetchMode = \PDO::FETCH_ASSOC, $useMaster = false)
    {
        $context = $this->_context;

        $context->sql = $sql;
        $context->bind = $bind;
        $context->affected_rows = 0;

        $this->eventsManager->fireEvent('db:beforeQuery', $this);

        if ($context->connection) {
            $type = null;
            $connection = $context->connection;
        } else {
            $type = $this->_has_slave ? 'slave' : 'default';
            $connection = $this->poolManager->pop($this, $this->_timeout, $type);
        }

        try {
            $start_time = microtime(true);
            $result = $connection->query($sql, $bind, $fetchMode, $useMaster);
            $elapsed = round(microtime(true) - $start_time, 3);
        } finally {
            if ($type) {
                $this->poolManager->push($this, $connection, $type);
            }
        }

        $count = $context->affected_rows = count($result);

        $event_data = compact('elapsed', 'count', 'sql', 'bind', 'result');

        $this->logger->debug($event_data, 'db.query');

        $this->eventsManager->fireEvent('db:afterQuery', $this, $event_data);

        return $result;
    }
public function fetchAll($sql, $bind = [], $fetchMode = \PDO::FETCH_ASSOC, $useMaster = false)
    {
        $context = $this->_context;

        $context->sql = $sql;
        $context->bind = $bind;
        $context->affected_rows = 0;

        $this->eventsManager->fireEvent('db:beforeQuery', $this);

        if ($context->connection) {
            $type = null;
            $connection = $context->connection;
        } else {
            $type = $this->_has_slave ? 'slave' : 'default';
            $connection = $this->poolManager->pop($this, $this->_timeout, $type);
        }

        try {
            $start_time = microtime(true);
            $result = $connection->query($sql, $bind, $fetchMode, $useMaster);
            $elapsed = round(microtime(true) - $start_time, 3);
        } finally {
            if ($type) {
                $this->poolManager->push($this, $connection, $type);
            }
        }

        $count = $context->affected_rows = count($result);

        $event_data = compact('elapsed', 'count', 'sql', 'bind', 'result');

        $this->logger->debug($event_data, 'db.query');

        $this->eventsManager->fireEvent('db:afterQuery', $this, $event_data);

        return $result;
    }
public function fetchAll ( $ sql , $ bind = [ ] , $ fetchMode = \ PDO :: FETCH_ASSOC , $ useMaster = false ) { $ context = $ this -> _context ; $ context -> sql = $ sql ; $ context -> bind = $ bind ; $ context -> affected_rows = 0 ; $ this -> eventsManager -> fireEvent ( 'db:beforeQuery' , $ this ) ; if ( $ context -> connection ) { $ type = null ; $ connection = $ context -> connection ; } else { $ type = $ this -> _has_slave ? 'slave' : 'default' ; $ connection = $ this -> poolManager -> pop ( $ this , $ this -> _timeout , $ type ) ; } try { $ start_time = microtime ( true ) ; $ result = $ connection -> query ( $ sql , $ bind , $ fetchMode , $ useMaster ) ; $ elapsed = round ( microtime ( true ) - $ start_time , 3 ) ; } finally { if ( $ type ) { $ this -> poolManager -> push ( $ this , $ connection , $ type ) ; } } $ count = $ context -> affected_rows = count ( $ result ) ; $ event_data = compact ( 'elapsed' , 'count' , 'sql' , 'bind' , 'result' ) ; $ this -> logger -> debug ( $ event_data , 'db.query' ) ; $ this -> eventsManager -> fireEvent ( 'db:afterQuery' , $ this , $ event_data ) ; return $ result ; }
Dumps the complete result of a query into an array

@param string $sql
@param array  $bind
@param int    $fetchMode
@param bool   $useMaster

@return array
Dumps the complete result of a query into an array