Unverified Commit 64344760 authored by alexpott's avatar alexpott

Issue #2942569 by seanB, idebr, amateescu, kristiaanvandeneynde: Sorting...

Issue #2942569 by seanB, idebr, amateescu, kristiaanvandeneynde: Sorting nested properties of config entity queries does not work

(cherry picked from commit a07a4ba0)
parent ed21c9b4
......@@ -89,7 +89,14 @@ public function execute() {
$direction = $sort['direction'] == 'ASC' ? -1 : 1;
$field = $sort['field'];
uasort($result, function ($a, $b) use ($field, $direction) {
return ($a[$field] <= $b[$field]) ? $direction : -$direction;
$properties = explode('.', $field);
foreach ($properties as $property) {
if (isset($a[$property]) || isset($b[$property])) {
$a = isset($a[$property]) ? $a[$property] : NULL;
$b = isset($b[$property]) ? $b[$property] : NULL;
}
}
return ($a <= $b) ? $direction : -$direction;
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment