本文整理匯總了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);
}