eZ\Publish\Core\REST\Server\Controller\Location::loadLocationChildren PHP Method

loadLocationChildren() public method

Loads child locations of a location.
public loadLocationChildren ( string $locationPath, Request $request ) : LocationList
$locationPath string
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\LocationList
    public function loadLocationChildren($locationPath, Request $request)
    {
        $offset = $request->query->has('offset') ? (int) $request->query->get('offset') : 0;
        $limit = $request->query->has('limit') ? (int) $request->query->get('limit') : 10;
        $restLocations = array();
        $locationId = $this->extractLocationIdFromPath($locationPath);
        $children = $this->locationService->loadLocationChildren($this->locationService->loadLocation($locationId), $offset >= 0 ? $offset : 0, $limit >= 0 ? $limit : 25)->locations;
        foreach ($children as $location) {
            $restLocations[] = new Values\RestLocation($location, $this->locationService->getLocationChildCount($location));
        }
        return new Values\CachedValue(new Values\LocationList($restLocations, $request->getPathInfo()), array('locationId' => $locationId));
    }