ModelBundle/Repository/RepositoryTrait/AutoPublishableTrait.php
public function findElementToAutoUnpublish($siteId, StatusInterface $publishedStatus)
    {
        $date = new \Mongodate(strtotime(date('d F Y')));
        $statusId = new \MongoId($publishedStatus->getId());

        $qa = $this->createAggregationQuery();

        $filter = array(
            'siteId' => $siteId,
            'deleted' => false,
            'status._id' => $statusId,
            'status.outOfWorkflow' => false,
            'unpublishDate' => array('$lte' => $date)
        );

        $qa->match($filter);
        $qa->sort(array('createdAt' => 1));

        return $this->hydrateAggregateQuery($qa);
    }
public function findElementToAutoUnpublish($siteId, StatusInterface $publishedStatus)
    {
        $date = new \Mongodate(strtotime(date('d F Y')));
        $statusId = new \MongoId($publishedStatus->getId());

        $qa = $this->createAggregationQuery();

        $filter = array(
            'siteId' => $siteId,
            'deleted' => false,
            'status._id' => $statusId,
            'status.outOfWorkflow' => false,
            'unpublishDate' => array('$lte' => $date)
        );

        $qa->match($filter);
        $qa->sort(array('createdAt' => 1));

        return $this->hydrateAggregateQuery($qa);
    }
Find all elements (in all versions and all langauges) ready to be auto-unpublished

@param string          $siteId
@param StatusInterface $publishedStatus

@return array