Class MOXMAN_Util_ResultSet
Inheritance | MOXMAN_Util_ResultSet |
---|
This class handles tabular resultsets like a database table.
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Constructs a new result set instance. | MOXMAN_Util_ResultSet |
add() | Adds a new row to the result set the number of arguments to this function must match the number of columns used in the instance creation. | MOXMAN_Util_ResultSet |
fromJson() | Fills the result set with the specified array data. | MOXMAN_Util_ResultSet |
getCols() | Returns the current column names. | MOXMAN_Util_ResultSet |
getHeader() | Get the header as an name/value array. | MOXMAN_Util_ResultSet |
getRow() | Returns the specified row by index or null if it wasn't found. | MOXMAN_Util_ResultSet |
getRowCount() | Returns the current number of rows added to the result set. | MOXMAN_Util_ResultSet |
getRows() | Returns an indexed array with name/value items of the internal structure. | MOXMAN_Util_ResultSet |
setHeaderItem() | Sets a header item by name and value. | MOXMAN_Util_ResultSet |
toJson() | Converts the internal structure to an array. This can then be serialized using JSON. | MOXMAN_Util_ResultSet |
Method Details
Constructs a new result set instance.
public void __construct ( $cols, $header = [] ) | ||
$cols | string | Comma separated list of columns. |
$header | Array | Name/value header array to attach to result set. |
Adds a new row to the result set the number of arguments to this function must match the number of columns used in the instance creation.
public void add ( ) |
Fills the result set with the specified array data.
public static MOXMAN_Util_ResultSet fromJson ( $json ) | ||
$json | Object | Json object to populate the ResultSet with. |
return | MOXMAN_Util_ResultSet | Result set instance based on the data. |
---|
Returns the current column names.
public Array getCols ( ) | ||
return | Array | Current columns as an array. |
---|
Get the header as an name/value array.
public Array getHeader ( ) | ||
return | Array | Name/value array with header items. |
---|
Returns the specified row by index or null if it wasn't found.
public Array getRow ( $index ) | ||
$index | int | Index of item to retrive. |
return | Array | Name/value array with values. |
---|
Returns the current number of rows added to the result set.
public int getRowCount ( ) | ||
return | int | Number of rows added to result set. |
---|
Returns an indexed array with name/value items of the internal structure.
public void getRows ( ) |
Sets a header item by name and value.
public void setHeaderItem ( $name, $value ) | ||
$name | string | Name to set in header. |
$value | Mixed | Value to set in header. |
Converts the internal structure to an array. This can then be serialized using JSON.
public Object toJson ( ) | ||
return | Object | Name/value array with header, columns and data. |
---|