/**
  * Searches children locations of the provided parent location id.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Location $location
  * @param int $offset
  * @param int $limit
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult
  */
 protected function searchChildrenLocations(APILocation $location, $offset = 0, $limit = -1)
 {
     $query = new LocationQuery(['filter' => new Criterion\ParentLocationId($location->id), 'offset' => $offset >= 0 ? (int) $offset : 0, 'limit' => $limit >= 0 ? (int) $limit : null, 'sortClauses' => $location->getSortClauses()]);
     return $this->repository->getSearchService()->findLocations($query);
 }
예제 #2
0
 /**
  * Returns (searches) subgroups of a user group described by its main location.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Location $location
  * @param int $offset
  * @param int $limit
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult
  */
 protected function searchSubGroups(Location $location, $offset = 0, $limit = 25)
 {
     $searchQuery = new LocationQuery();
     $searchQuery->offset = $offset;
     $searchQuery->limit = $limit;
     $searchQuery->filter = new CriterionLogicalAnd([new CriterionContentTypeId($this->settings['userGroupClassID']), new CriterionParentLocationId($location->id)]);
     $searchQuery->sortClauses = $location->getSortClauses();
     return $this->repository->getSearchService()->findLocations($searchQuery, array(), false);
 }