bundle/Topic/UrlGenerator.php
private function getTopicValueObject(Tag $tag)
    {
        $rootLocation = $this->loadService->loadLocation(
            $this->configResolver->getParameter('content.tree_root.location_id')
        );

        $query = new LocationQuery();
        $query->limit = 1;

        $query->filter = new Criterion\LogicalAnd(
            [
                new Criterion\Subtree($rootLocation->pathString),
                new Criterion\LogicalNot(new Criterion\LocationId($rootLocation->id)),
                new Criterion\Location\IsMainLocation(Criterion\Location\IsMainLocation::MAIN),
                new Criterion\Visibility(Criterion\Visibility::VISIBLE),
                new Criterion\ContentTypeIdentifier(['ng_topic']),
                new TagId($tag->id),
            ]
        );

        $searchResult = $this->findService->findLocations($query);

        if (!empty($searchResult->searchHits)) {
            return $searchResult->searchHits[0]->valueObject;
        }

        return $tag;
    }
private function getTopicValueObject(Tag $tag)
    {
        $rootLocation = $this->loadService->loadLocation(
            $this->configResolver->getParameter('content.tree_root.location_id')
        );

        $query = new LocationQuery();
        $query->limit = 1;

        $query->filter = new Criterion\LogicalAnd(
            [
                new Criterion\Subtree($rootLocation->pathString),
                new Criterion\LogicalNot(new Criterion\LocationId($rootLocation->id)),
                new Criterion\Location\IsMainLocation(Criterion\Location\IsMainLocation::MAIN),
                new Criterion\Visibility(Criterion\Visibility::VISIBLE),
                new Criterion\ContentTypeIdentifier(['ng_topic']),
                new TagId($tag->id),
            ]
        );

        $searchResult = $this->findService->findLocations($query);

        if (!empty($searchResult->searchHits)) {
            return $searchResult->searchHits[0]->valueObject;
        }

        return $tag;
    }
private function getTopicValueObject ( Tag $ tag ) { $ rootLocation = $ this -> loadService -> loadLocation ( $ this -> configResolver -> getParameter ( 'content.tree_root.location_id' ) ) ; $ query = new LocationQuery ( ) ; $ query -> limit = 1 ; $ query -> filter = new Criterion \ LogicalAnd ( [ new Criterion \ Subtree ( $ rootLocation -> pathString ) , new Criterion \ LogicalNot ( new Criterion \ LocationId ( $ rootLocation -> id ) ) , new Criterion \ Location \ IsMainLocation ( Criterion \ Location \ IsMainLocation :: MAIN ) , new Criterion \ Visibility ( Criterion \ Visibility :: VISIBLE ) , new Criterion \ ContentTypeIdentifier ( [ 'ng_topic' ] ) , new TagId ( $ tag -> id ) , ] ) ; $ searchResult = $ this -> findService -> findLocations ( $ query ) ; if ( ! empty ( $ searchResult -> searchHits ) ) { return $ searchResult -> searchHits [ 0 ] -> valueObject ; } return $ tag ; }
If exists, returns the location of the content with ng_topic identifier connected to provided tag.

Otherwise, the tag itself is returned.

@return \Netgen\EzPlatformSiteApi\API\Values\Location|\Netgen\TagsBundle\API\Repository\Values\Tags\Tag
If exists returns the location of the content with ng_topic identifier connected to provided tag .