From 100e67f2a70c740245dffb28fb3d111968b921b6 Mon Sep 17 00:00:00 2001 From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> Date: Fri, 21 Jul 2023 15:06:34 +0000 Subject: [PATCH] fix order during export and linking, fixes #2959 and #1361 Closes #2959 and #1361 Merge request studip/studip!1991 --- lib/models/Courseware/StructuralElement.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/models/Courseware/StructuralElement.php b/lib/models/Courseware/StructuralElement.php index 42b876042a6..11227d233c7 100644 --- a/lib/models/Courseware/StructuralElement.php +++ b/lib/models/Courseware/StructuralElement.php @@ -1045,9 +1045,7 @@ SQL; private function linkChildren(User $user, StructuralElement $newElement): void { - $children = self::findBySQL('parent_id = ?', [$this->id]); - - foreach ($children as $child) { + foreach ($this->children as $child) { $child->link($user, $newElement); } } @@ -1104,9 +1102,8 @@ SQL; private function getChildrenPdfExport(int $depth, bool $with_children, $user, $doc) { - $children = self::findBySQL('parent_id = ?', [$this->id]); $depth++; - foreach ($children as $child) { + foreach ($this->children as $child) { $child->getElementPdfExport($depth, $with_children, $user, $doc); } } -- GitLab