HosipLan

Untitled

Jun 21st, 2011
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Repositories;
  4.  
  5. use Entities;
  6.  
  7. class ThreadRepository extends EntityRepository
  8. {
  9.    
  10.     public function findMostViewed()
  11.     {
  12.     $qb = $this->_em->getRepository('Entity\Thread')
  13.         ->createQueryBuilder('t')
  14.         ->orderBy('t.viewed', 'DESC')
  15.         ->setMaxResults(5);
  16.  
  17.     return $qb->getQuery()->getResult();
  18.     }
  19.    
  20. }
Advertisement
Add Comment
Please, Sign In to add comment