ClanCats Hydrahon Versions Save

🐉 Fast & standalone PHP MySQL Query Builder library.

v1.1.4

7 years ago

This patch fixes the issue where the query builders orderBy method ignores raw expressions.

$cars->orderBy(new Expression('brand <> bmw', 'desc');

v1.1.3

7 years ago

Features

Limit, Offset and Where Reset

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();

Changes

Result Grouping Bug

This quick release also fixes a bug where an exception is thrown when hydrahon tries to group an empty result.

v1.1.2

7 years ago

Features

Added result grouping

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}
    ]
}

Key forwarding

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}
}

Changes

Execute select query

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(); 

v1.1.1

7 years ago

v1.1.0

7 years ago

These release brings some heavy changes on the Hydrahon query structure to allow other query builder like arango to be implemented.

New features are:

  • Subqueries in select from.
  • Nested join conditions.

v1.0

8 years ago