protected function fetchRows($cursor, $all = true, $indexBy = null)
    {
        $token = 'fetch cursor id = ' . $cursor->getId();
        Yii::info($token, __METHOD__);
        try {
            Yii::beginProfile($token, __METHOD__);
            $result = $this->fetchRowsInternal($cursor, $all);
            Yii::endProfile($token, __METHOD__);

            return $result;
        } catch (\Exception $e) {
            Yii::endProfile($token, __METHOD__);
            throw new Exception($e->getMessage(), (int) $e->getCode(), $e);
        }
    }
protected function fetchRows($cursor, $all = true, $indexBy = null)
    {
        $token = 'fetch cursor id = ' . $cursor->getId();
        Yii::info($token, __METHOD__);
        try {
            Yii::beginProfile($token, __METHOD__);
            $result = $this->fetchRowsInternal($cursor, $all);
            Yii::endProfile($token, __METHOD__);

            return $result;
        } catch (\Exception $e) {
            Yii::endProfile($token, __METHOD__);
            throw new Exception($e->getMessage(), (int) $e->getCode(), $e);
        }
    }
protected function fetchRows ( $ cursor , $ all = true , $ indexBy = null ) { $ token = 'fetch cursor id = ' . $ cursor -> getId ( ) ; Yii :: info ( $ token , __METHOD__ ) ; try { Yii :: beginProfile ( $ token , __METHOD__ ) ; $ result = $ this -> fetchRowsInternal ( $ cursor , $ all ) ; Yii :: endProfile ( $ token , __METHOD__ ) ; return $ result ; } catch ( \ Exception $ e ) { Yii :: endProfile ( $ token , __METHOD__ ) ; throw new Exception ( $ e -> getMessage ( ) , ( int ) $ e -> getCode ( ) , $ e ) ; } }
Fetches rows from the given Mongo cursor.
@param \MongoDB\Driver\Cursor $cursor Mongo cursor instance to fetch data from.
@param bool $all whether to fetch all rows or only first one.
@param string|callable $indexBy the column name or PHP callback,
by which the query results should be indexed by.
@throws Exception on failure.
@return array|bool result.
Fetches rows from the given Mongo cursor .