Latest release

Hydrahon v1.1.8

@mario-deluna mario-deluna released this Feb 23, 2018

Changes

Feature: query flags

Query flags allow you to store parameters inside a query object. This can be very useful when passing a query object through multiple modifiers.

$movies = $h->table('movies');

$movies->join('review', 'review.movie_id', '=', 'review.id');
$movies->setFlag('reviewIsJoined', true);

// somewhere later ...

if ($movies->getFlag('reviewIsJoined', false)) {
    $movies->orderBy('review.rating');
}

Hydrahon v1.1.7

@mario-deluna mario-deluna released this Apr 15, 2017 · 28 commits to master since this release

1.1.7 is a really small release and changes the following:

Changes

  • Added PHPUnit 4 as a dev dependency. Tests should be from now on executed using vendor/bin/phpunit.
  • PHP Doc fix in the table method to make the life of IDE users better. Thanks @kingmaryjonatan.

Hydrahon v1.1.6

@mario-deluna mario-deluna released this Aug 26, 2016 · 41 commits to master since this release

This releases does not add any new features but makes the implementation a bit easier.

Changes

  • Removed php 5.3 support. This thing is old, really, really old it's time to say goodbye.
  • Added FetchableInterfaceThis makes it easy for you to identify if a query should be fetched or not.

Example from the readme has been updated:

$connection = new PDO('mysql:host=localhost;dbname=my_database', 'username', 'password');

$hydrahon = new \ClanCats\Hydrahon\Builder('mysql', function($query, $queryString, $queryParameters) use($connection)
{
    $statement = $connection->prepare($queryString);
    $statement->execute($queryParameters);

    if ($query instanceof \ClanCats\Hydrahon\Query\Sql\FetchableInterface)
    {
        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }
});

Hydrahon v1.1.5

@mario-deluna mario-deluna released this Aug 25, 2016 · 48 commits to master since this release

Features

I've added an EXISTS query object allowing you to do a query like this one:

SELECT EXISTS(select id from showtimes) as hasShows

Like that:

$h->table('showtimes')->select()->exists(); // returns bool true

Obviously that select query can do everything like the normal select.

$h->table('showtimes')
    ->select()
    ->where(function($q)
    {
        $q->where('start', '>', time());
        $q->orWhere('end', '<', time() + 3600);
    })
    ->exists();

Hydrahon v1.1.4

@mario-deluna mario-deluna released this Aug 19, 2016 · 50 commits to master since this release

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

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

Hydrahon v1.1.3

@mario-deluna mario-deluna released this Jun 15, 2016 · 55 commits to master since this release

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.

Hydrahon v1.1.2

@mario-deluna mario-deluna released this Jun 9, 2016 · 58 commits to master since this release

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 Table alias in delete fix.

@mario-deluna mario-deluna released this Jun 3, 2016 · 61 commits to master since this release

Merge branch 'developer'

Hydrahon v1.1.0

@mario-deluna mario-deluna released this Jun 3, 2016 · 64 commits to master since this release

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.

Hydrahon v1.0

@mario-deluna mario-deluna released this Jul 19, 2015 · 94 commits to master since this release

Readme update