Twig/ArticleViewDocumentTwigExtension.php
public function loadSimilar(
        $limit = ArticleViewDocumentRepository::DEFAULT_LIMIT,
        array $types = null,
        $locale = null,
        $ignoreWebspaces = false
    ) {
        $uuid = null;

        $request = $this->requestStack->getCurrentRequest();

        $articleDocument = $request->get('object');
        if ($articleDocument instanceof ArticleDocument) {
            $uuid = $articleDocument->getUuid();

            if (!$types) {
                $types = [$this->getArticleType($articleDocument)];
            }
        }

        if (!$uuid) {
            throw new ArticleInRequestNotFoundException();
        }

        if (!$locale) {
            $locale = $request->getLocale();
        }

        $webspaceKey = $this->getWebspaceKey($request, $ignoreWebspaces);

        $articleViewDocuments = $this->articleViewDocumentRepository->findSimilar(
            $uuid,
            $limit,
            $types,
            $locale,
            $webspaceKey
        );

        return $this->getResourceItems($articleViewDocuments);
    }
public function loadSimilar(
        $limit = ArticleViewDocumentRepository::DEFAULT_LIMIT,
        array $types = null,
        $locale = null,
        $ignoreWebspaces = false
    ) {
        $uuid = null;

        $request = $this->requestStack->getCurrentRequest();

        $articleDocument = $request->get('object');
        if ($articleDocument instanceof ArticleDocument) {
            $uuid = $articleDocument->getUuid();

            if (!$types) {
                $types = [$this->getArticleType($articleDocument)];
            }
        }

        if (!$uuid) {
            throw new ArticleInRequestNotFoundException();
        }

        if (!$locale) {
            $locale = $request->getLocale();
        }

        $webspaceKey = $this->getWebspaceKey($request, $ignoreWebspaces);

        $articleViewDocuments = $this->articleViewDocumentRepository->findSimilar(
            $uuid,
            $limit,
            $types,
            $locale,
            $webspaceKey
        );

        return $this->getResourceItems($articleViewDocuments);
    }
public function loadSimilar ( $ limit = ArticleViewDocumentRepository :: DEFAULT_LIMIT , array $ types = null , $ locale = null , $ ignoreWebspaces = false ) { $ uuid = null ; $ request = $ this -> requestStack -> getCurrentRequest ( ) ; $ articleDocument = $ request -> get ( 'object' ) ; if ( $ articleDocument instanceof ArticleDocument ) { $ uuid = $ articleDocument -> getUuid ( ) ; if ( ! $ types ) { $ types = [ $ this -> getArticleType ( $ articleDocument ) ] ; } } if ( ! $ uuid ) { throw new ArticleInRequestNotFoundException ( ) ; } if ( ! $ locale ) { $ locale = $ request -> getLocale ( ) ; } $ webspaceKey = $ this -> getWebspaceKey ( $ request , $ ignoreWebspaces ) ; $ articleViewDocuments = $ this -> articleViewDocumentRepository -> findSimilar ( $ uuid , $ limit , $ types , $ locale , $ webspaceKey ) ; return $ this -> getResourceItems ( $ articleViewDocuments ) ; }
Loads similar articles with given parameters.

@param int $limit
@param array|null $types
@param null $locale
@param bool $ignoreWebspaces

@throws ArticleInRequestNotFoundException

@return ArticleResourceItem[]
Loads similar articles with given parameters .