Repository/DoctrineContentfulEntryRepository.php
function findByContentType(ContentfulContentType $contentType)
    {
        // Do not rely on Mysql Group By.
        $query   = $this->getEntityManager()->createQuery(
            'SELECT e1 FROM Dothiv\Bundle\ContentfulBundle\Item\ContentfulEntry e1 '
            . 'WHERE e1.contentTypeId = :contentTypeId '
            . 'AND e1.spaceId = :spaceId '
            . 'AND e1.revision = (SELECT MAX(e2.revision) FROM Dothiv\Bundle\ContentfulBundle\Item\ContentfulEntry e2 WHERE e2.id = e1.id AND e2.spaceId = :spaceId)')
            ->setParameter('contentTypeId', $contentType->getId())
            ->setParameter('spaceId', $contentType->getSpaceId())
        ;
        return new ArrayCollection($query->getResult());
    }
function findByContentType(ContentfulContentType $contentType)
    {
        // Do not rely on Mysql Group By.
        $query   = $this->getEntityManager()->createQuery(
            'SELECT e1 FROM Dothiv\Bundle\ContentfulBundle\Item\ContentfulEntry e1 '
            . 'WHERE e1.contentTypeId = :contentTypeId '
            . 'AND e1.spaceId = :spaceId '
            . 'AND e1.revision = (SELECT MAX(e2.revision) FROM Dothiv\Bundle\ContentfulBundle\Item\ContentfulEntry e2 WHERE e2.id = e1.id AND e2.spaceId = :spaceId)')
            ->setParameter('contentTypeId', $contentType->getId())
            ->setParameter('spaceId', $contentType->getSpaceId())
        ;
        return new ArrayCollection($query->getResult());
    }
@param ContentfulContentType $contentType

@return ContentfulEntry[]|ArrayCollection