ModelBundle/Repository/ContentTypeRepository.php
public function findAllNotDeletedInLastVersionForPaginate(PaginateFinderConfiguration $configuration)
    {
        $qa = $this->createAggregateQueryNotDeletedInLastVersion();
        $filters = $this->getFilterSearch($configuration);
        if (!empty($filters)) {
            $qa->match($filters);
        }
        $elementName = 'contentType';
        $group = array(
            'names' => array('$last' => '$names'),
            'contentTypeId' => array('$last' => '$contentTypeId')
        );
        $this->generateLastVersionFilter($qa, $elementName, $group);

        $order = $configuration->getOrder();
        if (!empty($order)) {
            $qa->sort($order);
        }

        $qa->skip($configuration->getSkip());
        $qa->limit($configuration->getLimit());

        return $this->hydrateAggregateQuery($qa, $elementName, 'getContentTypeId');
    }
public function findAllNotDeletedInLastVersionForPaginate(PaginateFinderConfiguration $configuration)
    {
        $qa = $this->createAggregateQueryNotDeletedInLastVersion();
        $filters = $this->getFilterSearch($configuration);
        if (!empty($filters)) {
            $qa->match($filters);
        }
        $elementName = 'contentType';
        $group = array(
            'names' => array('$last' => '$names'),
            'contentTypeId' => array('$last' => '$contentTypeId')
        );
        $this->generateLastVersionFilter($qa, $elementName, $group);

        $order = $configuration->getOrder();
        if (!empty($order)) {
            $qa->sort($order);
        }

        $qa->skip($configuration->getSkip());
        $qa->limit($configuration->getLimit());

        return $this->hydrateAggregateQuery($qa, $elementName, 'getContentTypeId');
    }
@param PaginateFinderConfiguration $configuration

@return array