/** * static getAllRoles($returnAsArray = false) * * @param boolean $returnAsArray - should it return the results as an array of arrays or as an array of ACLRoles * * @return either an array of array representations of acl roles or an array of ACLRoles */ function getAllRoles($returnAsArray = false) { $db = DBManagerFactory::getInstance(); $query = "SELECT acl_roles.* FROM acl_roles\n WHERE acl_roles.deleted=0 ORDER BY name"; $result = $db->query($query); $roles = []; while ($row = $db->fetchByAssoc($result)) { $role = new ACLRole(); $role->populateFromRow($row); if ($returnAsArray) { $roles[] = $role->toArray(); } else { $roles[] = $role; } } return $roles; }