public function executeFind(EntityMetadata $metadata, Store $store, array $criteria, array $fields = [], array $sort = [], $offset = 0, $limit = 0)
    {
        $criteria = $this->getFormatter()->formatQuery($metadata, $store, $criteria);

        $builder = $this->createQueryBuilder($metadata)
            ->find()
            ->setQueryArray($criteria)
        ;

        $this->appendSearch($builder, $criteria);
        $this->appendFields($builder, $fields);
        $this->appendSort($builder, $sort);
        $this->appendLimitAndOffset($builder, $limit, $offset);

        return $builder->getQuery()->execute();
    }
public function executeFind(EntityMetadata $metadata, Store $store, array $criteria, array $fields = [], array $sort = [], $offset = 0, $limit = 0)
    {
        $criteria = $this->getFormatter()->formatQuery($metadata, $store, $criteria);

        $builder = $this->createQueryBuilder($metadata)
            ->find()
            ->setQueryArray($criteria)
        ;

        $this->appendSearch($builder, $criteria);
        $this->appendFields($builder, $fields);
        $this->appendSort($builder, $sort);
        $this->appendLimitAndOffset($builder, $limit, $offset);

        return $builder->getQuery()->execute();
    }
public function executeFind ( EntityMetadata $ metadata , Store $ store , array $ criteria , array $ fields = [ ] , array $ sort = [ ] , $ offset = 0 , $ limit = 0 ) { $ criteria = $ this -> getFormatter ( ) -> formatQuery ( $ metadata , $ store , $ criteria ) ; $ builder = $ this -> createQueryBuilder ( $ metadata ) -> find ( ) -> setQueryArray ( $ criteria ) ; $ this -> appendSearch ( $ builder , $ criteria ) ; $ this -> appendFields ( $ builder , $ fields ) ; $ this -> appendSort ( $ builder , $ sort ) ; $ this -> appendLimitAndOffset ( $ builder , $ limit , $ offset ) ; return $ builder -> getQuery ( ) -> execute ( ) ; }
Finds records from the database based on the provided metadata and criteria.

@param   EntityMetadata  $metadata   The model metadata that the database should query against.
@param   Store           $store      The store.
@param   array           $criteria   The query criteria.
@param   array           $fields     Fields to include/exclude.
@param   array           $sort       The sort criteria.
@param   int             $offset     The starting offset, aka the number of Models to skip.
@param   int             $limit      The number of Models to limit.
@return  \Doctrine\MongoDB\Cursor
Finds records from the database based on the provided metadata and criteria .