original_string: public function getPaginator($params = array()) 
  	{
  		$page = isset($params['page']) ? (int)$params['page'] : 1;
  		$email = isset($params['email']) ? $params['email'] : null;
  		$limit = isset($params['limit']) ? (int) $params['limit'] : 10;
  		$offset = isset($params['offset']) ? (int) $params['offset'] : 0;
  		
  		
  		$qb = $this->_em->createQueryBuilder();
  		$qb->select(array('a'));
  		$qb->from($this->getEntityName(), 'a');
  		$qb->addOrderBy('a.dateInsert', 'DESC');
  		
  		if(null !== $email) {
  			$qb->andWhere($qb->expr()->eq('a.email', ':paramEmail'));
  			$qb->setParameter('paramEmail', $email);
  		}
  		
  		$query = $qb->getQuery();
  		$query->setFirstResult($offset);
  		$query->setMaxResults($limit);
  // 		$paginator = new DoctrinePaginator($query, $fetchJoinCollection = true);
  // 		$result = array();
  // 		foreach($paginator as $p) {
  // 			$result[] = $p->getUserId();
  // 		}
  // 		$result = $query->getResult();
  // 		$paginatorAdapter =  new RazorPaginator(
  // 			$result,
  // 			count($paginator)
  // 		);
  		$paginatorAdapter = new DoctrinePaginatorAdapter(new DoctrinePaginator($query));
  		$paginator = new Paginator($paginatorAdapter);
  		$paginator->setCurrentPageNumber($page);
  		$paginator->setDefaultItemCountPerPage($limit);
  		
  		return $paginator;
  	}
code: public function getPaginator($params = array()) 
  	{
  		$page = isset($params['page']) ? (int)$params['page'] : 1;
  		$email = isset($params['email']) ? $params['email'] : null;
  		$limit = isset($params['limit']) ? (int) $params['limit'] : 10;
  		$offset = isset($params['offset']) ? (int) $params['offset'] : 0;
  		
  		
  		$qb = $this->_em->createQueryBuilder();
  		$qb->select(array('a'));
  		$qb->from($this->getEntityName(), 'a');
  		$qb->addOrderBy('a.dateInsert', 'DESC');
  		
  		if(null !== $email) {
  			$qb->andWhere($qb->expr()->eq('a.email', ':paramEmail'));
  			$qb->setParameter('paramEmail', $email);
  		}
  		
  		$query = $qb->getQuery();
  		$query->setFirstResult($offset);
  		$query->setMaxResults($limit);
  // 		$paginator = new DoctrinePaginator($query, $fetchJoinCollection = true);
  // 		$result = array();
  // 		foreach($paginator as $p) {
  // 			$result[] = $p->getUserId();
  // 		}
  // 		$result = $query->getResult();
  // 		$paginatorAdapter =  new RazorPaginator(
  // 			$result,
  // 			count($paginator)
  // 		);
  		$paginatorAdapter = new DoctrinePaginatorAdapter(new DoctrinePaginator($query));
  		$paginator = new Paginator($paginatorAdapter);
  		$paginator->setCurrentPageNumber($page);
  		$paginator->setDefaultItemCountPerPage($limit);
  		
  		return $paginator;
  	}
code_tokens: public function getPaginator ( $ params = array ( ) ) { $ page = isset ( $ params [ 'page' ] ) ? ( int ) $ params [ 'page' ] : 1 ; $ email = isset ( $ params [ 'email' ] ) ? $ params [ 'email' ] : null ; $ limit = isset ( $ params [ 'limit' ] ) ? ( int ) $ params [ 'limit' ] : 10 ; $ offset = isset ( $ params [ 'offset' ] ) ? ( int ) $ params [ 'offset' ] : 0 ; $ qb = $ this -> _em -> createQueryBuilder ( ) ; $ qb -> select ( array ( 'a' ) ) ; $ qb -> from ( $ this -> getEntityName ( ) , 'a' ) ; $ qb -> addOrderBy ( 'a.dateInsert' , 'DESC' ) ; if ( null !== $ email ) { $ qb -> andWhere ( $ qb -> expr ( ) -> eq ( 'a.email' , ':paramEmail' ) ) ; $ qb -> setParameter ( 'paramEmail' , $ email ) ; } $ query = $ qb -> getQuery ( ) ; $ query -> setFirstResult ( $ offset ) ; $ query -> setMaxResults ( $ limit ) ; // 		$paginator = new DoctrinePaginator($query, $fetchJoinCollection = true); // 		$result = array(); // 		foreach($paginator as $p) { // 			$result[] = $p->getUserId(); // 		} // 		$result = $query->getResult(); // 		$paginatorAdapter =  new RazorPaginator( // 			$result, // 			count($paginator) // 		); $ paginatorAdapter = new DoctrinePaginatorAdapter ( new DoctrinePaginator ( $ query ) ) ; $ paginator = new Paginator ( $ paginatorAdapter ) ; $ paginator -> setCurrentPageNumber ( $ page ) ; $ paginator -> setDefaultItemCountPerPage ( $ limit ) ; return $ paginator ; }
docstring: Return the paginator
  
  @param array $params
  @return \Zend\Paginator\Paginator
docstring_tokens: Return the paginator