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

loadLocationChildren() public method

Loads children which are readable by the current user of a location object sorted by sortField and sortOrder.
public loadLocationChildren ( eZ\Publish\API\Repository\Values\Content\Location $location, integer $offset, integer $limit = 25 ) : eZ\Publish\API\Repository\Values\Content\LocationList
$location eZ\Publish\API\Repository\Values\Content\Location
$offset integer the start offset for paging
$limit integer the number of locations returned
return eZ\Publish\API\Repository\Values\Content\LocationList
    public function loadLocationChildren(APILocation $location, $offset = 0, $limit = 25)
    {
        if (!$this->domainMapper->isValidLocationSortField($location->sortField)) {
            throw new InvalidArgumentValue('sortField', $location->sortField, 'Location');
        }
        if (!$this->domainMapper->isValidLocationSortOrder($location->sortOrder)) {
            throw new InvalidArgumentValue('sortOrder', $location->sortOrder, 'Location');
        }
        if (!is_int($offset)) {
            throw new InvalidArgumentValue('offset', $offset);
        }
        if (!is_int($limit)) {
            throw new InvalidArgumentValue('limit', $limit);
        }
        $childLocations = array();
        $searchResult = $this->searchChildrenLocations($location, $offset, $limit);
        foreach ($searchResult->searchHits as $searchHit) {
            $childLocations[] = $searchHit->valueObject;
        }
        return new LocationList(array('locations' => $childLocations, 'totalCount' => $searchResult->totalCount));
    }