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:
parent
6612e4c1ae
commit
7b7a7c9299
|
@ -304,10 +304,6 @@ class Connection implements Selectable
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($query->getSortColumns() as $col) {
|
|
||||||
ldap_sort($this->ds, $results, $col[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$entries = array();
|
$entries = array();
|
||||||
$entry = ldap_first_entry($this->ds, $results);
|
$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)));
|
} 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);
|
ldap_free_result($results);
|
||||||
return $entries;
|
return $entries;
|
||||||
}
|
}
|
||||||
|
@ -444,7 +444,11 @@ class Connection implements Selectable
|
||||||
ldap_control_paged_result($this->ds, 0);
|
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)
|
protected function cleanupAttributes($attributes, array $requestedFields)
|
||||||
|
|
Loading…
Reference in New Issue