eZ\Publish\Core\Search\Elasticsearch\Content\Mapper\StandardMapper::getAncestorLocationsContentIds PHP Method

getAncestorLocationsContentIds() protected method

Used to determine user groups of a user with $contentId.
protected getAncestorLocationsContentIds ( integer | string $contentId ) : array
$contentId integer | string
return array
    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);
    }