Is there an example anywhere of a a dynamic programmatically generated nested statement using the ZF3 SQL builder?
here is what I tried:
if ($true) {
$where = new Where();
$firstone = false;
foreach ($users as $user) {
if ($firstone) {
$where->OR->equalTo('BUYER', $user);
}
else {
$where->NEST->equalTo('BUYER', $user);
}
$firstone = true;
}
$where->UNNEST;
array_push($data, $where);
}
$resultSetPrototype = new ResultSet ();
$resultSetPrototype->setArrayObjectPrototype(new SUPLIER ());
// create a new pagination adapter object
$paginatorAdapter = new DbSelect (
// our configured select object
$select->where($data)->order("NAME ASC"),
// the adapter to run it against
$this->tableGateway->getAdapter(),
// the result set to hydrate
$resultSetPrototype);
$paginator = new Paginator ($paginatorAdapter);
return $paginator;