I solved the problem by looking at the source code zf2
If you know how to do this, it’s very simple, the code above was almost right!
Instead
$predicate = new Zend\Db\Sql\Predicate\Predicate();
you should use
$predicate = new \Zend\Db\Sql\Where();
it is an empty derived class that is used in Zend \ Db \ Sql \ Sql
this is a complete working example:
$sql->select()
->columns(array('GroupedColum'
,'minValue' => new Expression('min(ValueColumn)')))
->from('ValueTable')
->group('GroupedColum')
->order('minValue')
->order('GroupedColum')
->limit(10);
$predicate = new \Zend\Db\Sql\Where();
$sql->where($predicate->greaterThan('filterColumn','20'));
source
share