ModelBundle/Repository/TrashItemRepository.php
protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa, $siteId)
    {
        $qa->match(array('siteId' => $siteId));

        $name = $configuration->getSearchIndex('name');
        if (null !== $name && '' !== $name) {
            $qa->match(array('name' => new \MongoRegex('/.*'.$name.'.*/i')));
        }

        $type = $configuration->getSearchIndex('type');
        if (null !== $type && '' !== $type) {
            $qa->match(array('type' => $type));
        }

        $dateBefore = $configuration->getSearchIndex('date-before');
        if (null !== $dateBefore && '' !== $dateBefore) {
            $dateFormatBefore = $configuration->getSearchIndex('date-format-before');
            if (null !== $dateFormatBefore && '' !== $dateFormatBefore) {
                $dateBefore = $this->getFormattedDate($dateBefore, $dateFormatBefore);
                $qa->match(array('deletedAt' => array('$lt' => new \MongoDate(strtotime($dateBefore)))));
            }
        }

        $dateAfter = $configuration->getSearchIndex('date-after');
        if (null !== $dateAfter && '' !== $dateAfter) {
            $dateFormatAfter = $configuration->getSearchIndex('date-format-after');
            if (null !== $dateFormatAfter && '' !== $dateFormatAfter) {
                $dateAfter = $this->getFormattedDate($dateAfter, $dateFormatAfter);
                $qa->match(array('deletedAt' => array('$gt' => new \MongoDate(strtotime($dateAfter)))));
            }
        }

        return $qa;
    }
protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa, $siteId)
    {
        $qa->match(array('siteId' => $siteId));

        $name = $configuration->getSearchIndex('name');
        if (null !== $name && '' !== $name) {
            $qa->match(array('name' => new \MongoRegex('/.*'.$name.'.*/i')));
        }

        $type = $configuration->getSearchIndex('type');
        if (null !== $type && '' !== $type) {
            $qa->match(array('type' => $type));
        }

        $dateBefore = $configuration->getSearchIndex('date-before');
        if (null !== $dateBefore && '' !== $dateBefore) {
            $dateFormatBefore = $configuration->getSearchIndex('date-format-before');
            if (null !== $dateFormatBefore && '' !== $dateFormatBefore) {
                $dateBefore = $this->getFormattedDate($dateBefore, $dateFormatBefore);
                $qa->match(array('deletedAt' => array('$lt' => new \MongoDate(strtotime($dateBefore)))));
            }
        }

        $dateAfter = $configuration->getSearchIndex('date-after');
        if (null !== $dateAfter && '' !== $dateAfter) {
            $dateFormatAfter = $configuration->getSearchIndex('date-format-after');
            if (null !== $dateFormatAfter && '' !== $dateFormatAfter) {
                $dateAfter = $this->getFormattedDate($dateAfter, $dateFormatAfter);
                $qa->match(array('deletedAt' => array('$gt' => new \MongoDate(strtotime($dateAfter)))));
            }
        }

        return $qa;
    }
@param PaginateFinderConfiguration $configuration
@param Stage                       $qa
@param string                      $siteId

@return array