Commit b7ca1b18 authored by catch's avatar catch
Browse files

Issue #3556884 by alexpott, smustgrave:...

Issue #3556884 by alexpott, smustgrave: \Drupal\workspaces\WorkspaceRepository::loadTree() uses NULL as an array key

(cherry picked from commit 79fea467)
parent d37c9dfc
Loading
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -69,13 +69,15 @@ public function loadTree() {

      $tree_children = [];
      foreach ($workspaces as $workspace_id => $workspace) {
        $tree_children[$workspace->parent->target_id][] = $workspace_id;
        $key = $workspace->hasParent() ? $workspace->parent->target_id : '';
        $tree_children[$key][] = $workspace_id;
      }

      // Keeps track of the parents we have to process, the last entry is used
      // for the next processing step. Top-level (root) workspace use NULL as
      // the parent, so we need to initialize the list with that value.
      $process_parents[] = NULL;
      // for the next processing step. Top-level (root) workspace use an empty
      // string as the parent, so we need to initialize the list with that
      // value.
      $process_parents[] = '';

      // Loops over the parent entities and adds its children to the tree array.
      // Uses a loop instead of a recursion, because it's more efficient.