Skip to content

Commit

Permalink
chore: build tree based on provided parent classes to keep the right …
Browse files Browse the repository at this point in the history
…order
  • Loading branch information
shpran committed Oct 18, 2023
1 parent 9839ed7 commit 095eb16
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions model/DataBaseAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,14 @@ public function getClassesResources(array $classesIds): array
]
);

$classesResources = [];
$tree = [];

foreach ($results as $result) {
$classesResources[$result['object']][] = $result['subject'];
foreach ($classesIds as $classId) {
$resources = array_filter($results, static fn (array $result): bool => $result['object'] === $classId);
$tree[$classId] = array_column($resources, 'subject');
}

return $classesResources;
return $tree;
}

public function getResourceTree(core_kernel_classes_Resource $resource): array
Expand Down

0 comments on commit 095eb16

Please sign in to comment.