Releases: ClanCats/Hydrahon
Hydrahon v1.1.14
Fixed a few more type hints.
Hydrahon v1.1.13
A small quality of live release. I've added a lot of missing type hints and fixed wrong ones. This has been long overdue but should now ease working with and IDE.
Hydrahon v1.1.12
- Fixed an error where table aliases where not being set.
- Fixed identifier escaping, thanks @lucasnodari
- Added
whereNotIn
helper, thanks @AeonFr :
$people->select()->whereNotIn('city', ['Zürich', 'Bern', 'Basel'])->get();
- Fixed travis build
Hydrahon v1.1.11
This release fixes an error when trying to pass multiple expression to an order by statement:
$h->table('people')->select()
->orderBy([new Expression('rand()'), new Expression('rand()')])
->execute();
select * from `people` order by func1() asc, func2() asc
There is currently no way changing the direction per order statement in the array syntax. So the direction is set for all given order statements in the array.
$h->table('people')->select()
->orderBy([new Expression('func1()'), new Expression('func2()')], 'desc')
->execute();
select * from `people` order by func1() desc, func2() desc
The fix should also allow mixed arrays:
$h->table('people')->select()
->orderBy(['name' => 'asc', new Expression('func()')], 'desc')
->execute();
select * from `people` order by `name` asc, func() desc
Hydrahon v1.1.10
This release brings support for replace queries.
Example:
$h->table('movie_title')->replace([
'movie_id' => '1',
'language' => 'de',
'title' => 'Der Fluch der Karibik'
])->execute();
results in the following query string:
replace into `movie_title` (`language`, `movie_id`, `title`) values (?, ?, ?)
Hydrahon v1.1.9
Fixed custom select query object inheritance.
The Select
class is now able to fully inherit its properties from a parent select class.
Example:
class BurgerQuery extends ClanCats\Hydrahon\Query\Sql\Select
{
public function onlyTastyOnes()
{
$this->where('tasty', 1);
}
}
$query = new BurgerQuery(
$h->table('burgers')->select()->limit(50)
);
$query->onlyTastyOnes();
$tastyBurgers = $query->get();
Hydrahon v1.1.8
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
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
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
FetchableInterface
This 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
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();