Queries are executed with {@link \Elgg\Database::executeQuery()} and results
are retrieved with {@link \PDO::fetchObject()}. If a callback
function $callback is defined, each row will be passed as a single
argument to $callback. If no callback function is defined, the
entire result set is returned as an array.
public getData ( string $query, callable $callback = null, array $params = [] ) : array | ||
$query | string | The query being passed. |
$callback | callable | Optionally, the name of a function to call back to on each row |
$params | array | Query params. E.g. [1, 'steve'] or [':id' => 1, ':name' => 'steve'] |
return | array | An array of database result objects or callback function results. If the query returned nothing, an empty array. |