src/Phlexible/Bundle/ElementBundle/Search/AbstractSearch.php
protected function doSearch(array $rows, $title, $language = null)
    {
        if ($language === null) {
            $language = $this->defaultLanguage;
        }

        $results = [];
        foreach ($rows as $row) {
            $node = $this->treeManager->getByNodeId($row['id'])->get($row['id']);

            if (!$this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN') && !$this->authorizationChecker->isGranted('VIEW', $node)) {
                continue;
            }

            $element = $this->elementService->findElement($node->getTypeId());
            $elementVersion = $this->elementService->findLatestElementVersion($element);
            $siteroot = $this->siterootManager->find($node->getTree()->getSiterootId());

            $handlerData = array(
                'handler' => 'element',
                'parameters' => array(
                    'id' => $node->getId(),
                    'siteroot_id' => $node->getTree()->getSiterootId(),
                    'title' => $siteroot->getTitle($language),
                    'start_tid_path' => '/'.implode('/', $node->getTree()->getIdPath($node)),
                ),
            );

            $createUserName = 'Unknown User';
            try {
                $createUser = $this->userManager->find($elementVersion->getCreateUserId());
                if ($createUser) {
                    $createUserName = $createUser->getDisplayName();
                }
            } catch (\Exception $e) {
            }

            $icon = $this->iconResolver->resolveTreeNode($node, $language);

            $results[] = new SearchResult(
                $node->getId(),
                $siteroot->getTitle($language).' :: '.$elementVersion->getBackendTitle($language).' ('.$language.', '.$node->getId().')',
                $createUserName,
                $elementVersion->getCreatedAt(),
                $icon,
                $title,
                $handlerData
            );
        }

        return $results;
    }
protected function doSearch(array $rows, $title, $language = null)
    {
        if ($language === null) {
            $language = $this->defaultLanguage;
        }

        $results = [];
        foreach ($rows as $row) {
            $node = $this->treeManager->getByNodeId($row['id'])->get($row['id']);

            if (!$this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN') && !$this->authorizationChecker->isGranted('VIEW', $node)) {
                continue;
            }

            $element = $this->elementService->findElement($node->getTypeId());
            $elementVersion = $this->elementService->findLatestElementVersion($element);
            $siteroot = $this->siterootManager->find($node->getTree()->getSiterootId());

            $handlerData = array(
                'handler' => 'element',
                'parameters' => array(
                    'id' => $node->getId(),
                    'siteroot_id' => $node->getTree()->getSiterootId(),
                    'title' => $siteroot->getTitle($language),
                    'start_tid_path' => '/'.implode('/', $node->getTree()->getIdPath($node)),
                ),
            );

            $createUserName = 'Unknown User';
            try {
                $createUser = $this->userManager->find($elementVersion->getCreateUserId());
                if ($createUser) {
                    $createUserName = $createUser->getDisplayName();
                }
            } catch (\Exception $e) {
            }

            $icon = $this->iconResolver->resolveTreeNode($node, $language);

            $results[] = new SearchResult(
                $node->getId(),
                $siteroot->getTitle($language).' :: '.$elementVersion->getBackendTitle($language).' ('.$language.', '.$node->getId().')',
                $createUserName,
                $elementVersion->getCreatedAt(),
                $icon,
                $title,
                $handlerData
            );
        }

        return $results;
    }
protected function doSearch ( array $ rows , $ title , $ language = null ) { if ( $ language === null ) { $ language = $ this -> defaultLanguage ; } $ results = [ ] ; foreach ( $ rows as $ row ) { $ node = $ this -> treeManager -> getByNodeId ( $ row [ 'id' ] ) -> get ( $ row [ 'id' ] ) ; if ( ! $ this -> authorizationChecker -> isGranted ( 'ROLE_SUPER_ADMIN' ) && ! $ this -> authorizationChecker -> isGranted ( 'VIEW' , $ node ) ) { continue ; } $ element = $ this -> elementService -> findElement ( $ node -> getTypeId ( ) ) ; $ elementVersion = $ this -> elementService -> findLatestElementVersion ( $ element ) ; $ siteroot = $ this -> siterootManager -> find ( $ node -> getTree ( ) -> getSiterootId ( ) ) ; $ handlerData = array ( 'handler' => 'element' , 'parameters' => array ( 'id' => $ node -> getId ( ) , 'siteroot_id' => $ node -> getTree ( ) -> getSiterootId ( ) , 'title' => $ siteroot -> getTitle ( $ language ) , 'start_tid_path' => '/' . implode ( '/' , $ node -> getTree ( ) -> getIdPath ( $ node ) ) , ) , ) ; $ createUserName = 'Unknown User' ; try { $ createUser = $ this -> userManager -> find ( $ elementVersion -> getCreateUserId ( ) ) ; if ( $ createUser ) { $ createUserName = $ createUser -> getDisplayName ( ) ; } } catch ( \ Exception $ e ) { } $ icon = $ this -> iconResolver -> resolveTreeNode ( $ node , $ language ) ; $ results [ ] = new SearchResult ( $ node -> getId ( ) , $ siteroot -> getTitle ( $ language ) . ' :: ' . $ elementVersion -> getBackendTitle ( $ language ) . ' (' . $ language . ', ' . $ node -> getId ( ) . ')' , $ createUserName , $ elementVersion -> getCreatedAt ( ) , $ icon , $ title , $ handlerData ) ; } return $ results ; }
Perform search.

@param array  $rows
@param string $title
@param string $language

@return array
Perform search .