Guest User

Untitled

a guest
Oct 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. public function getCages($query, cageQueryParams $params)
  2. {
  3.  
  4. $q = $this->createQuery('c')
  5. ->leftJoin('c.Strain s')
  6. ->leftJoin('c.MouseCage m')
  7. ->where('m.dateout IS NULL');
  8.  
  9. if($params->strainid) {
  10. $q->addWhere('c.strain_id = ?', $params->strainid);
  11. }
  12.  
  13. if($params->projectlicenceid) {
  14. $q->addWhere('c.project_licence_id = ?', $params->projectlicenceid);
  15. }
  16.  
  17. //lots more ifs here
  18.  
  19. $q->andWhere('c.is_active = ?', '1')
  20. ->addOrderBy('c.number DESC')
  21. ->limit(10);
  22.  
  23. return $q->execute();
  24. }
Add Comment
Please, Sign In to add comment