public function findNodes(LocationQuery $query) { $searchResult = $this->searchService->findLocations($query, ['languages' => $this->prioritizedLanguages, 'useAlwaysAvailable' => $this->useAlwaysAvailable]); foreach ($searchResult->searchHits as $searchHit) { /** @var \eZ\Publish\API\Repository\Values\Content\Location $location */ $location = $searchHit->valueObject; $searchHit->valueObject = $this->domainObjectMapper->mapNode($location, $this->contentService->loadContent($location->contentInfo->id, [$searchHit->matchedTranslation], $location->contentInfo->currentVersionNo), $searchHit->matchedTranslation); } return $searchResult; }
/** * Returns Site Node object for the given Repository $location. * * @throws \Netgen\EzPlatformSiteApi\Core\Site\Exceptions\TranslationNotMatchedException * * @param \eZ\Publish\API\Repository\Values\Content\Location $location * * @return \Netgen\EzPlatformSiteApi\API\Values\Node */ private function getSiteNode(APILocation $location) { $versionInfo = $this->contentService->loadVersionInfoById($location->contentInfo->id); $languageCode = $this->getLanguage($versionInfo->languageCodes, $versionInfo->contentInfo->mainLanguageCode, $versionInfo->contentInfo->alwaysAvailable); if ($languageCode === null) { throw new TranslationNotMatchedException($versionInfo->contentInfo->id, $this->getContext($versionInfo)); } return $this->domainObjectMapper->mapNode($location, $this->contentService->loadContent($location->contentInfo->id, [$languageCode], $location->contentInfo->currentVersionNo), $languageCode); }