eZ\Publish\Core\Repository\LocationService::loadLocations PHP Method

loadLocations() public method

If a $rootLocation is given, only locations that belong to this location are returned. The location list is also filtered by permissions on reading locations.
public loadLocations ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, eZ\Publish\API\Repository\Values\Content\Location $rootLocation = null ) : eZ\Publish\API\Repository\Values\Content\Location[]
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
$rootLocation eZ\Publish\API\Repository\Values\Content\Location
return eZ\Publish\API\Repository\Values\Content\Location[] An array of {@link Location}
    public function loadLocations(ContentInfo $contentInfo, APILocation $rootLocation = null)
    {
        if (!$contentInfo->published) {
            throw new BadStateException('$contentInfo', 'ContentInfo has no published versions');
        }
        $spiLocations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($contentInfo->id, $rootLocation !== null ? $rootLocation->id : null);
        $locations = array();
        foreach ($spiLocations as $spiLocation) {
            $locations[] = $this->domainMapper->buildLocationDomainObject($spiLocation);
        }
        return $locations;
    }