Bundle/CoreBundle/Repository/ViewRepository.php
public function findByViewReferences(array $viewReferences)
    {
        $pageIds = [];
        foreach ($viewReferences as $viewReference) {
            if ($viewReference instanceof BusinessPageReference) {
                $pageIds[] = $viewReference->getTemplateId();
            } else {
                $pageIds[] = $viewReference->getViewId();
            }
        }

        $qb = $this->getInstance();
        $qb->andWhere($this->mainAlias.'.id IN (:pageIds)')
            ->setParameter('pageIds', $pageIds);

        $pages = $qb->getQuery()->getResult();

        foreach ($pages as $page) {
            $pageId = $page->getId();
            $viewReference = array_filter(
                $viewReferences,
                function ($e) use ($pageId) {
                    return $e->getViewId() == $pageId;
                });
            if (!empty($viewReference[0])) {
                $page->setCurrentLocale($viewReference[0]->getLocale());
            }
        }

        return $pages;
    }
public function findByViewReferences(array $viewReferences)
    {
        $pageIds = [];
        foreach ($viewReferences as $viewReference) {
            if ($viewReference instanceof BusinessPageReference) {
                $pageIds[] = $viewReference->getTemplateId();
            } else {
                $pageIds[] = $viewReference->getViewId();
            }
        }

        $qb = $this->getInstance();
        $qb->andWhere($this->mainAlias.'.id IN (:pageIds)')
            ->setParameter('pageIds', $pageIds);

        $pages = $qb->getQuery()->getResult();

        foreach ($pages as $page) {
            $pageId = $page->getId();
            $viewReference = array_filter(
                $viewReferences,
                function ($e) use ($pageId) {
                    return $e->getViewId() == $pageId;
                });
            if (!empty($viewReference[0])) {
                $page->setCurrentLocale($viewReference[0]->getLocale());
            }
        }

        return $pages;
    }
public function findByViewReferences ( array $ viewReferences ) { $ pageIds = [ ] ; foreach ( $ viewReferences as $ viewReference ) { if ( $ viewReference instanceof BusinessPageReference ) { $ pageIds [ ] = $ viewReference -> getTemplateId ( ) ; } else { $ pageIds [ ] = $ viewReference -> getViewId ( ) ; } } $ qb = $ this -> getInstance ( ) ; $ qb -> andWhere ( $ this -> mainAlias . '.id IN (:pageIds)' ) -> setParameter ( 'pageIds' , $ pageIds ) ; $ pages = $ qb -> getQuery ( ) -> getResult ( ) ; foreach ( $ pages as $ page ) { $ pageId = $ page -> getId ( ) ; $ viewReference = array_filter ( $ viewReferences , function ( $ e ) use ( $ pageId ) { return $ e -> getViewId ( ) == $ pageId ; } ) ; if ( ! empty ( $ viewReference [ 0 ] ) ) { $ page -> setCurrentLocale ( $ viewReference [ 0 ] -> getLocale ( ) ) ; } } return $ pages ; }
Find a large amount of views by ViewReferences.

@param ViewReference[] $viewReferences

@return View[]|null The entity instance or NULL if the entities cannot be found.
Find a large amount of views by ViewReferences .