Rest/Controller/ContentTypeController.php
protected function prepareContentByContentTypeIds($contentTypeIds, Request $request)
    {
        $options = $this->parseParameters($request->query, ['page_size', 'page', 'path', 'hidden', 'lang', 'sa', 'image']);

        $pageSize = (int)$options->get('page_size', self::PAGE_SIZE);
        $page = (int)$options->get('page', 1);
        $offset = $page * $pageSize - $pageSize;
        $path = $options->get('path');
        $hidden = $options->get('hidden');
        $lang = $options->get('lang');
        $siteAccess = $options->get('sa');

        $rootLocationPathString = $this->locationService->loadLocation(
            $this->siteAccessHelper->getRootLocationBySiteAccessName($siteAccess)
        )->pathString;

        $contentItems = array();

        foreach ($contentTypeIds as $contentTypeId) {
            $criteria = array(new Criterion\ContentTypeId($contentTypeId));

            if ($path) {
                $criteria[] = new Criterion\Subtree($path);
            }

            if (!$hidden) {
                $criteria[] = new Criterion\Visibility(Criterion\Visibility::VISIBLE);
            }

            $criteria[] = new Criterion\Subtree($rootLocationPathString);

            $query = new Query();
            $query->query = new Criterion\LogicalAnd($criteria);
            $query->limit = $pageSize;
            $query->offset = $offset;

            $contentItems[$contentTypeId] = $this->searchService->findContent(
                $query,
                (!empty($lang) ? array('languages' => array($lang)) : array())
            )->searchHits;
        }

        $contentOptions = $this->parseParameters($request->query, ['lang', 'fields', 'image']);

        return $this->content->prepareContent($contentItems, $contentOptions);
    }
protected function prepareContentByContentTypeIds($contentTypeIds, Request $request)
    {
        $options = $this->parseParameters($request->query, ['page_size', 'page', 'path', 'hidden', 'lang', 'sa', 'image']);

        $pageSize = (int)$options->get('page_size', self::PAGE_SIZE);
        $page = (int)$options->get('page', 1);
        $offset = $page * $pageSize - $pageSize;
        $path = $options->get('path');
        $hidden = $options->get('hidden');
        $lang = $options->get('lang');
        $siteAccess = $options->get('sa');

        $rootLocationPathString = $this->locationService->loadLocation(
            $this->siteAccessHelper->getRootLocationBySiteAccessName($siteAccess)
        )->pathString;

        $contentItems = array();

        foreach ($contentTypeIds as $contentTypeId) {
            $criteria = array(new Criterion\ContentTypeId($contentTypeId));

            if ($path) {
                $criteria[] = new Criterion\Subtree($path);
            }

            if (!$hidden) {
                $criteria[] = new Criterion\Visibility(Criterion\Visibility::VISIBLE);
            }

            $criteria[] = new Criterion\Subtree($rootLocationPathString);

            $query = new Query();
            $query->query = new Criterion\LogicalAnd($criteria);
            $query->limit = $pageSize;
            $query->offset = $offset;

            $contentItems[$contentTypeId] = $this->searchService->findContent(
                $query,
                (!empty($lang) ? array('languages' => array($lang)) : array())
            )->searchHits;
        }

        $contentOptions = $this->parseParameters($request->query, ['lang', 'fields', 'image']);

        return $this->content->prepareContent($contentItems, $contentOptions);
    }
protected function prepareContentByContentTypeIds ( $ contentTypeIds , Request $ request ) { $ options = $ this -> parseParameters ( $ request -> query , [ 'page_size' , 'page' , 'path' , 'hidden' , 'lang' , 'sa' , 'image' ] ) ; $ pageSize = ( int ) $ options -> get ( 'page_size' , self :: PAGE_SIZE ) ; $ page = ( int ) $ options -> get ( 'page' , 1 ) ; $ offset = $ page * $ pageSize - $ pageSize ; $ path = $ options -> get ( 'path' ) ; $ hidden = $ options -> get ( 'hidden' ) ; $ lang = $ options -> get ( 'lang' ) ; $ siteAccess = $ options -> get ( 'sa' ) ; $ rootLocationPathString = $ this -> locationService -> loadLocation ( $ this -> siteAccessHelper -> getRootLocationBySiteAccessName ( $ siteAccess ) ) -> pathString ; $ contentItems = array ( ) ; foreach ( $ contentTypeIds as $ contentTypeId ) { $ criteria = array ( new Criterion \ ContentTypeId ( $ contentTypeId ) ) ; if ( $ path ) { $ criteria [ ] = new Criterion \ Subtree ( $ path ) ; } if ( ! $ hidden ) { $ criteria [ ] = new Criterion \ Visibility ( Criterion \ Visibility :: VISIBLE ) ; } $ criteria [ ] = new Criterion \ Subtree ( $ rootLocationPathString ) ; $ query = new Query ( ) ; $ query -> query = new Criterion \ LogicalAnd ( $ criteria ) ; $ query -> limit = $ pageSize ; $ query -> offset = $ offset ; $ contentItems [ $ contentTypeId ] = $ this -> searchService -> findContent ( $ query , ( ! empty ( $ lang ) ? array ( 'languages' => array ( $ lang ) ) : array ( ) ) ) -> searchHits ; } $ contentOptions = $ this -> parseParameters ( $ request -> query , [ 'lang' , 'fields' , 'image' ] ) ; return $ this -> content -> prepareContent ( $ contentItems , $ contentOptions ) ; }
Returns paged content based on ContentType ids.

@param array $contentTypeIds
@param \Symfony\Component\HttpFoundation\Request $request

@return array
Returns paged content based on ContentType ids .