protected function getAncestorLocationsContentIds($contentId) { $locations = $this->locationHandler->loadLocationsByContent($contentId); $ancestorLocationContentIds = array(); $ancestorLocationIds = array(); foreach ($locations as $location) { $locationIds = explode('/', trim($location->pathString, '/')); // Remove Location of Content with $contentId array_pop($locationIds); // Remove Root Location id (id==1 in legacy DB) array_shift($locationIds); $ancestorLocationIds = array_merge($ancestorLocationIds, $locationIds); } foreach (array_unique($ancestorLocationIds) as $locationId) { $location = $this->locationHandler->load($locationId); $ancestorLocationContentIds[$location->contentId] = true; } return array_keys($ancestorLocationContentIds); }