Created
June 20, 2012 14:45
-
-
Save Tocacar/2960231 to your computer and use it in GitHub Desktop.
Query idea
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function getCages($query, cageQueryParams $params) | |
| { | |
| $q = $this->createQuery('c') | |
| ->leftJoin('c.Strain s') | |
| ->leftJoin('c.MouseCage m') | |
| ->where('m.dateout IS NULL'); | |
| if($params->strainid) { | |
| $q->addWhere('c.strain_id = ?', $params->strainid); | |
| } | |
| if($params->projectlicenceid) { | |
| $q->addWhere('c.project_licence_id = ?', $params->projectlicenceid); | |
| } | |
| //lots more ifs here | |
| $q->andWhere('c.is_active = ?', '1') | |
| ->addOrderBy('c.number DESC') | |
| ->limit(10); | |
| return $q->execute(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment