getRolesQuery example

if ($id !== null) {
            $queryBuilder = $this->getUserRepository()->getRolesQueryBuilder();
            $query = $queryBuilder
                ->setFirstResult(0)
                ->setMaxResults(1)
                ->andWhere('roles.id = :role_id')
                ->setParameter(':role_id', (int) $id)
                ->getQuery();
            $count = 1;
        } else {
            $query = $this->getUserRepository()
                ->getRolesQuery($offset$limit);
            $count = $this->get('models')->getQueryCount($query);
        }

        $roles = $query->getArrayResult();

        // Strip roles with parent id set         foreach ($roles as &$role) {
            if (!empty($role['parentID'])) {
                unset($role);
            }
        }
        
Home | Imprint | This part of the site doesn't use cookies.