original_string: protected function fetchResult(Select $select, AbstractResultSet $resultSet = null)
      {
          $resultSet = $resultSet ?: $this->getResultSet();
          $resultSet->buffer();
  
          if ($this->usePaginator()) {
              $this->setUsePaginator(false);
              $resultSet = $this->paginate($select, $resultSet);
          } else {
              $statement = $this->getSql()->prepareStatementForSqlObject($select);
              $result = $statement->execute();
              $resultSet->initialize($result);
          }
  
          return $resultSet;
      }
code: protected function fetchResult(Select $select, AbstractResultSet $resultSet = null)
      {
          $resultSet = $resultSet ?: $this->getResultSet();
          $resultSet->buffer();
  
          if ($this->usePaginator()) {
              $this->setUsePaginator(false);
              $resultSet = $this->paginate($select, $resultSet);
          } else {
              $statement = $this->getSql()->prepareStatementForSqlObject($select);
              $result = $statement->execute();
              $resultSet->initialize($result);
          }
  
          return $resultSet;
      }
code_tokens: protected function fetchResult ( Select $ select , AbstractResultSet $ resultSet = null ) { $ resultSet = $ resultSet ? : $ this -> getResultSet ( ) ; $ resultSet -> buffer ( ) ; if ( $ this -> usePaginator ( ) ) { $ this -> setUsePaginator ( false ) ; $ resultSet = $ this -> paginate ( $ select , $ resultSet ) ; } else { $ statement = $ this -> getSql ( ) -> prepareStatementForSqlObject ( $ select ) ; $ result = $ statement -> execute ( ) ; $ resultSet -> initialize ( $ result ) ; } return $ resultSet ; }
docstring: Fetches the result of select from database
  
  @param Select $select
  @param AbstractResultSet $resultSet
  @return \Zend\Db\ResultSet\ResultSet|Paginator|HydratingResultSet
docstring_tokens: Fetches the result of select from database