ModelBundle/Repository/NodeRepository.php
public function findPublishedSortedByVersion($nodeId, $language, $siteId)
    {
        $qa = $this->createAggregationQueryBuilderWithSiteIdAndLanguage($siteId, $language);
        $qa->match(
            array(
                'nodeId'  => $nodeId,
                'status.publishedState' => true,
            )
        );
        $qa->sort(array('createdAt' => -1));

        return $this->hydrateAggregateQuery($qa);
    }
public function findPublishedSortedByVersion($nodeId, $language, $siteId)
    {
        $qa = $this->createAggregationQueryBuilderWithSiteIdAndLanguage($siteId, $language);
        $qa->match(
            array(
                'nodeId'  => $nodeId,
                'status.publishedState' => true,
            )
        );
        $qa->sort(array('createdAt' => -1));

        return $this->hydrateAggregateQuery($qa);
    }
@param string $nodeId
@param string $language
@param string $siteId

@throws \Exception

@return mixed