public function findActiveUsers($countOnly, $offset, $limit, array $editorRoles)
{
$expr = $this->getEntityManager()->getExpressionBuilder();
$qb = $this->createPublicUserQueryBuilder();
$editorIds = $this->getEditorIds($editorRoles);
if (!empty($editorIds)) {
$qb->andWhere($qb->expr()->in('u.id', $editorIds));
}
if ($countOnly) {
$qb->select('COUNT(u.id)');
return $qb->getQuery()->getSingleScalarResult();
}
$qb->addOrderBy('u.id', 'ASC');
$qb->groupBy('u.id');
$qb->setFirstResult($offset);
$qb->setMaxResults($limit);
$results = $qb->getQuery()->getResult();
return $results;
}