public function toArray($returnFields = array())
    {
        if (!$this->isColl) {
            $data = array_fill_keys($returnFields ?: $this->getFields(), null);
            if (!$returnFields) {
                return $this->data + $data;
            } else {
                $data = array_fill_keys($returnFields, null);
                return array_intersect_key($this->data, $data) + $data;
            }
        } else {
            $data = array();
            /** @var $record Record */
            foreach ($this->data as $key => $record) {
                $data[$key] = $record->toArray($returnFields);
            }
            return $data;
        }
    }
public function toArray($returnFields = array())
    {
        if (!$this->isColl) {
            $data = array_fill_keys($returnFields ?: $this->getFields(), null);
            if (!$returnFields) {
                return $this->data + $data;
            } else {
                $data = array_fill_keys($returnFields, null);
                return array_intersect_key($this->data, $data) + $data;
            }
        } else {
            $data = array();
            /** @var $record Record */
            foreach ($this->data as $key => $record) {
                $data[$key] = $record->toArray($returnFields);
            }
            return $data;
        }
    }
public function toArray ( $ returnFields = array ( ) ) { if ( ! $ this -> isColl ) { $ data = array_fill_keys ( $ returnFields ? : $ this -> getFields ( ) , null ) ; if ( ! $ returnFields ) { return $ this -> data + $ data ; } else { $ data = array_fill_keys ( $ returnFields , null ) ; return array_intersect_key ( $ this -> data , $ data ) + $ data ; } } else { $ data = array ( ) ; /** @var $record Record */ foreach ( $ this -> data as $ key => $ record ) { $ data [ $ key ] = $ record -> toArray ( $ returnFields ) ; } return $ data ; } }
Returns the record data as array

@param array $returnFields A indexed array specified the fields to return
@return array
Returns the record data as array