本文整理汇总了PHP中eZ\Publish\API\Repository\LocationService::loadLocationChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP LocationService::loadLocationChildren方法的具体用法?PHP LocationService::loadLocationChildren怎么用?PHP LocationService::loadLocationChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\API\Repository\LocationService
的用法示例。
在下文中一共展示了LocationService::loadLocationChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browseLocation
/**
* Prints out the location name, and recursively calls itself on each its children
*
* @param \eZ\Publish\API\Repository\Values\Content\Location $location
* @param int $depth The current depth
*
* @param OutputInterface $output
*/
private function browseLocation(Location $location, OutputInterface $output, $depth = 0)
{
// indent according to depth and write out the name of the content
$output->write(str_pad(' ', $depth));
$output->writeln($location->contentInfo->name);
// we request the location's children using the location service, and call browseLocation on each
$childLocations = $this->locationService->loadLocationChildren($location);
foreach ($childLocations->locations as $childLocation) {
$this->browseLocation($childLocation, $output, $depth + 1);
}
}
示例2: loadLocationChildren
/**
* Loads child locations of a location
*
* @param string $locationPath
*
* @return \eZ\Publish\Core\REST\Server\Values\LocationList
*/
public function loadLocationChildren($locationPath)
{
$offset = $this->request->query->has('offset') ? (int) $this->request->query->get('offset') : 0;
$limit = $this->request->query->has('limit') ? (int) $this->request->query->get('limit') : -1;
$restLocations = array();
$locationId = $this->extractLocationIdFromPath($locationPath);
foreach ($this->locationService->loadLocationChildren($this->locationService->loadLocation($locationId), $offset >= 0 ? $offset : 0, $limit >= 0 ? $limit : -1)->locations as $location) {
$restLocations[] = new Values\RestLocation($location, $this->locationService->getLocationChildCount($location));
}
return new Values\CachedValue(new Values\LocationList($restLocations, $this->request->getPathInfo()), array('locationId' => $locationId));
}
示例3: loadLocationChildren
/**
* Loads children which are readable by the current user of a location object sorted by sortField and sortOrder
*
* @param \eZ\Publish\API\Repository\Values\Content\Location $location
* @param int $offset the start offset for paging
* @param int $limit the number of locations returned
*
* @return \eZ\Publish\API\Repository\Values\Content\LocationList
*/
public function loadLocationChildren(Location $location, $offset = 0, $limit = 10)
{
return $this->service->loadLocationChildren($location, $offset, $limit);
}