Ldap\Connection: Add proper order support

Will now utilize SimpleQuery::compare() to provide support for multiple
order columns.

refs #8826
refs #7693
This commit is contained in:
Johannes Meyer 2015-05-04 11:36:38 +02:00
parent 6612e4c1ae
commit 7b7a7c9299
1 changed files with 9 additions and 5 deletions

View File

@ -304,10 +304,6 @@ class Connection implements Selectable
return array();
}
foreach ($query->getSortColumns() as $col) {
ldap_sort($this->ds, $results, $col[0]);
}
$count = 0;
$entries = array();
$entry = ldap_first_entry($this->ds, $results);
@ -320,6 +316,10 @@ class Connection implements Selectable
}
} while (($limit === 0 || $limit !== count($entries)) && ($entry = ldap_next_entry($this->ds, $entry)));
if ($query->hasOrder()) {
uasort($entries, array($query, 'compare'));
}
ldap_free_result($results);
return $entries;
}
@ -444,7 +444,11 @@ class Connection implements Selectable
ldap_control_paged_result($this->ds, 0);
}
return $entries; // TODO(7693): Sort entries post-processed
if ($query->hasOrder()) {
uasort($entries, array($query, 'compare'));
}
return $entries;
}
protected function cleanupAttributes($attributes, array $requestedFields)