Gets content from Bildy.
Functions inherited from API_Getter
getAmount
Details...
Returns actual amount of returned results.
Description
int getAmount (
void
)
This returns the total amount of results that this API_GetData returned.
If you are looking for total amount of results that would have been returned if there had not been a limit set for API_GetData, see getCount().
Return Values
Amount of results as integer. If the results have not been received yet, will return 0.
getCount
Details...
Returns total amount of results.
Description
void getCount (
void
)
This returns the total amount of results without limiting the result with setLimit().
If you are looking for actual amount of returned results with limit applied, see getAmount().
Return Values
Result amount as integer.
enableCount
Details...
Enables the use of getTotal() in a single result.
Description
void enableCount (
void
)
This function has to be called if a getTotal() call is used inside a single result.
The information about total amount of results without limit is not received by default, but this function enables it.
Return Values
No value is returned.
isEmpty
Details...
Checks for results.
Description
bool isEmpty (
void
)
Return Values
Boolean TRUE if there are no results and FALSE if there are results. Will always return FALSE when results have not been received yet.
setParent
Details...
Sets parent path where to get contents from.
Description
void setParent (
string $datamodel[,
int $id
= null
]
)
This method restricts path from which to get contents from.
Parameters
- datamodel
If id isn't defined, datamodel should be a path to the content.
If id is defined, datamodel should be name of the data model of the content.
- id(optional, default: null)
- The id of content. Define only if datamodel is set to a data model name.
Return Values
Nothing.
setWhere
Details...
Sets a condition that returned results must fill.
Description
void setWhere (
string $where
)
Condition is in the same format as MySQL where clause.
Please note that when using this method you must handle escaping of values yourself to make them safe for SQL. You can use B::escape() to do that.
Parameters
- where
A where clause to be used in SQL as is.
Using this method will erase all where conditions set before this one.
Return Values
No value is returned.
addWhere
Details...
Adds a condition that returned results must fill.
Description
void addWhere (
string $where
)
Condition is in the same format as MySQL where clause.
If you use setWhere() after using this function, all conditions will be reset except the newly set condition.
Parameters
- where
A condition that must be fulfilled for returned contents.
If you enter multiple conditions in one addWhere and use OR operator you should close the contents of this condition in parentheses to make sure conditions are grouped correctly.
Return Values
No value is returned.
setLimit
Details...
Limits amount of returned results.
Description
void setLimit (
int $limit
)
You can set the starting position of received results with setOffset().
Parameters
- limit
- The maximum amount of results to return.
Return Values
No value is returned.
setOffset
Details...
Sets the offset where to start returning results.
Description
void setOffset (
int $offset
)
You can choose how many results to show with setLimit().
Parameters
- offset
- The offset.
Return Values
No value is returned.
setOrderby
Details...
Alters the ordering of results.
Description
void setOrderby (
string $orderby[,
string $direction
= 'ASC'
]
)
Parameters
- orderby
The field which to use for ordering.
It is also possible to define multiple fields to order by by separating fields with comma.
- direction(optional, default: 'ASC')
If defined, will set the ordering direction.
Acceptable values are 'ASC' for ascending and 'DESC' for descending (case insensitive).
Return Values
No value is returned.
setDirection
Details...
Sets the ordering direction.
Description
void setDirection (
string $direction
)
Ordering of results defaults to ascending.
Parameters
- direction
- Acceptable values are 'ASC' for ascending and 'DESC' for descending (case insensitive).
Return Values
No value is returned.
getResult
Details...
Gets certain field in a row in the results
Description
string getResult (
int $index,
string $field[,
array $parameters
= array()
]
)
You can retrieve a single field in certain row with this method.
Parameters
- index
- Row number of the result. First result's index is 0.
- field
- Field to get.
- parameters(optional, default: array())
- Parameters to pass to the field. Does not apply to metadata fields.
Return Values
Value of the field.
getRow
Details...
Gets a result row object.
Description
API_Result getRow (
int $index
)
Gets a single result row object.
Parameters
- index
- Index number of the row to get.
Return Values
A result row object.
getArray
Details...
Gets result rows as arrays
Description
array getArray (
void
)
With this method you can get the result rows in an array of arrays instead of an array of API_Result objects.
Return Values
Array of result row arrays.
Functions
set
Details...
Sets a value or values to be received.
Description
void set (
string $field
)
If no fields are set to be received, all normal and metadata fields will be received. Receiving all fields might decrease performance if the table contains a lot of data.
Parameters
- field
Field name to receive.
Return Values
No value is returned.
get
Details...
Returns the results.
Description
array get (
void
)
This method should be called to retrieve the results after setting up the API_GetData.
Return Values
An array of API_GetDataResult objects.