SHARE
TWEET

Untitled

a guest Dec 9th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public function queryForSort($type, $categories)
  2.     {
  3.  
  4.         $db = $this->createQueryBuilder('p');
  5.  
  6.         if($type=='popularne'){
  7.             $db->addOrderBy('p.views', 'DESC');
  8.         } elseif ($type=='najnowsze'){
  9.             $db->addOrderBy('p.id', 'DESC');
  10.         } elseif($type='najciekawsze'){
  11.  
  12.             $db->addSelect('p.voteUp - p.voteDown as voteResult');
  13.             $db->addOrderBy('voteResult', 'DESC');
  14.         }
  15.  
  16.         $db
  17.             ->andWhere('p.isDeleted = :isDeleted')
  18.             ->setParameter('isDeleted', false)
  19.             ->andWhere('p.isWaitingRoom = :isWaitingRoom')
  20.             ->setParameter('isWaitingRoom', false);
  21.  
  22.              return $db->getQuery();
  23.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top