// Search
if (isset($filters['search'
])) { $filter = '%' .
$filters['search'
] . '%';
$stmt->
where('(s.namespace LIKE ? OR s.name LIKE ? OR s.value LIKE ?)',
$filter);
$secondStmt->
where('(s1.namespace LIKE ? OR s1.name LIKE ? OR s1.value LIKE ?)',
$filter);
} $selectUnion =
$this->database->
select()->
union(['(' .
$stmt . ')', '(' .
$secondStmt . ')'
], Zend_Db_Select::SQL_UNION_ALL
);
if (!
empty($order)) { $selectUnion->
order($order['property'
] . ' ' .
$order['direction'
]);
} else { $selectUnion->
order('namespace'
);
} $selectUnion->
limit($limit,
$start);
$countStmt =
clone $selectUnion;
$countStmt->
reset('limitcount'
) ->
reset('limitoffset'
);
$sql = 'SELECT COUNT(*) FROM (' .
$countStmt . ') as counter';