🐉 Fast & standalone PHP MySQL Query Builder library.
This patch fixes the issue where the query builders orderBy
method ignores raw expressions.
$cars->orderBy(new Expression('brand <> bmw', 'desc');
There are now resetter methods available for limit, offset and where statements.
// reset the limit to null
$query->resetLimit();
// reset the offset to null
$query->resetOffset();
// reset the where conditions
$query->resetWheres();
This quick release also fixes a bug where an exception is thrown when hydrahon tries to group an empty result.
The method groupResults
has been added allowing the direct grouping of associated array results.
$people
->select()
->groupResults('age')
->get();
Will transform:
[
{"name": "John", "age": 18},
{"name": "Jeff", "age": 32},
{"name": "Jenny", "age": 18}
]
Into:
{
"18": [
{"name": "John", "age": 18},
{"name": "Jenny", "age": 18}
],
"32": [
{"name": "Jeff", "age": 32}
]
}
Will use an items value as array key.
$people
->select()
->forwardKey('name')
->get();
Will transform:
[
{"name": "John", "age": 18},
{"name": "Johnna", "age": 22}
]
Into:
{
"John": {"name": "John", "age": 18},
"Johnna": {"name": "Johnna", "age": 22}
}
The execute a select query we were using the run
method which comes from CCF. I changed it to get
, inspired from laravels eloquent. I just feels much better.
So:
$persons->select()->run();
Becomes:
$persons->select()->get();
These release brings some heavy changes on the Hydrahon query structure to allow other query builder like arango to be implemented.
New features are: