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));
}