Skip to content

@mario-deluna mario-deluna released this Oct 13, 2020

Fixed a few more type hints.

Assets 2

@mario-deluna mario-deluna released this Sep 29, 2020 · 3 commits to master since this release

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.

Assets 2

@mario-deluna mario-deluna released this Sep 19, 2019 · 20 commits to master since this release

  • 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
Assets 2
  • v1.1.11
  • 3485e53
  • Compare
    Choose a tag to compare
    Search for a tag
  • v1.1.11
  • 3485e53
  • Compare
    Choose a tag to compare
    Search for a tag

@mario-deluna mario-deluna released this Feb 4, 2019 · 45 commits to master since this release

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
Assets 2

@mario-deluna mario-deluna released this Nov 26, 2018 · 47 commits to master since this release

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 (?, ?, ?)
Assets 2

@mario-deluna mario-deluna released this Nov 5, 2018 · 52 commits to master since this release

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();
Assets 2
  • v1.1.8
  • 29955bd
  • Compare
    Choose a tag to compare
    Search for a tag
  • v1.1.8
  • 29955bd
  • Compare
    Choose a tag to compare
    Search for a tag

@mario-deluna mario-deluna released this Feb 23, 2018 · 55 commits to master since this release

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');
}
Assets 2

@mario-deluna mario-deluna released this Apr 15, 2017 · 83 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.
Assets 2

@mario-deluna mario-deluna released this Aug 26, 2016 · 96 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);
    }
});
Assets 2

@mario-deluna mario-deluna released this Aug 25, 2016 · 103 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();
Assets 2