Skip to content

Commit

Permalink
fixes unwanted flatten results
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao committed Nov 25, 2024
1 parent 0f81655 commit e3da440
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions modules/tide_publication/src/Controller/PublicationResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@ protected function buildHierarchy(ContentEntityInterface $entity, NestedSetStora
// Try cache first.
$cid = "tide_publication:hierarchy:{$entity->uuid()}:{$weight}:" . ($site ? $site->id() : 'null');
if ($cached = $this->cacheData->get($cid)) {
$cache->addCacheTags($cached->tags);
$flatten_hierarchy = array_merge($flatten_hierarchy, $cached->data['flatten']);
return $cached->data['hierarchy'];
return $cached->data;
}

// Build basic node data.
Expand Down Expand Up @@ -218,12 +216,7 @@ protected function buildHierarchy(ContentEntityInterface $entity, NestedSetStora
}
}

// Cache the results.
$cache_data = [
'hierarchy' => $hierarchy,
'flatten' => $flatten_hierarchy,
];
$this->cacheData->set($cid, $cache_data, $cache->getCacheMaxAge(), $cache->getCacheTags());
$this->cacheData->set($cid, $hierarchy, $cache->getCacheMaxAge(), $cache->getCacheTags());

return $hierarchy;
}
Expand Down

0 comments on commit e3da440

Please sign in to comment.