/** * Fetch * * @param integer $offset Offset (starting from 0) * @param integer $limit Limit * @param string $sortField Field to sort by * @param string $sortDir Sort direction : 'ASC' or 'DES * @access public * @return array The 2D Array of the records */ function &fetch($offset = 0, $limit = null, $sortField = null, $sortDir = 'ASC') { $recordSet = array(); // Fetch the Data if ($numRows = $this->_result->numRows()) { while ($record = $this->_result->fetchRow(DB_FETCHMODE_ASSOC)) { $recordSet[] = $record; } } // Determine fields to render if (!$this->_options['fields']) { $this->setOptions(array('fields' => array_keys($recordSet[0]))); } // Limit and Sort the Data $recordSet =& Structures_DataGrid_DataSource_Array::staticFetch($recordSet, $this->_options['fields'], $offset, $limit, $sortField, $sortDir); return $recordSet; }