public function createService(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator)
 {
     $query = new Query();
     $queryServiceManager = $serviceLocator->get('query_service_manager');
     $query->setServiceManager($queryServiceManager);
     return $query;
 }
 public function convert(Query $query, \Core\Mapper\MapperInterface $mapper)
 {
     $mongoQuery = $this->convertCondition($query->getCondition());
     $cursor = $mapper->getCollection()->find($mongoQuery);
     $cursor->sort($this->convertSort($query->getSort()));
     $limit = $query->getLimit();
     if ($limit) {
         $cursor->limit($limit->count)->skip($limit->offset);
     }
     return $cursor;
 }
 public function convertQuery(\Core\Mapper\Query\Query $query)
 {
     $converter = $query->getServiceManager()->get('query_converter');
     return $converter->convert($query, $this);
 }