Skip to content

Hydrahon v1.1.11

Compare
Choose a tag to compare
@mario-deluna mario-deluna released this 04 Feb 09:48
· 47 commits to master since this release
3485e53

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