| @@ -54,9 +54,9 @@ | ||
| 54 | 54 | * @param mixed $filters |
| 55 | 55 | * @deprecated @param mixed $returnType |
| 56 | 56 | * @param mixed $orderBy |
| 57 | 57 | */ |
| 58 | - public function get($ids = array(), $fields = array('*'), $filters = array(), $returnType = OBJECT_K, $orderBy = array()) { | |
| 58 | + public function get($ids = array(), $fields = array('*'), $filters = array(), $returnType = OBJECT_K, $orderBy = array(), $useDefaultBackupFltr = true) { | |
| 59 | 59 | // Warn if $returnTypes is used |
| 60 | 60 | if ($returnType != OBJECT_K) { |
| 61 | 61 | die('Warning! Using $returnType with value other than OBJECT_K from the caller!!!'); |
| 62 | 62 | } |
| @@ -68,18 +68,20 @@ | ||
| 68 | 68 | $ids = implode(',', $ids); |
| 69 | 69 | $where[] = " `id` IN ({$ids})"; |
| 70 | 70 | } |
| 71 | 71 | // Filter by backup name. |
| 72 | - $where[] = (($filters['backupId'] == null) ? ' `backupId` IS NULL' : " `backupId` = {$filters['backupId']}"); | |
| 73 | - unset($filters['backupId']); | |
| 72 | + if ($useDefaultBackupFltr) { | |
| 73 | + $where[] = (!isset($filters['backupId']) ? ' `backupId` IS NULL' : " `backupId` = {$filters['backupId']}"); | |
| 74 | + unset($filters['backupId']); | |
| 75 | + } | |
| 74 | 76 | // Filter by parent. |
| 75 | - if ($filters['parent'] != null) { | |
| 77 | + if (isset($filters['parent'])) { | |
| 76 | 78 | $filters['parent'] = implode(',', ((array) $filters['parent'])); |
| 77 | 79 | $where[] = " `parent` IN ({$filters['parent']})"; |
| 78 | 80 | unset($filters['parent']); |
| 79 | 81 | } |
| 80 | 82 | // Types filter. |
| 81 | - if ($filters['types']) { | |
| 83 | + if (isset($filters['types'])) { | |
| 82 | 84 | $types = '"' . implode('", "', $filters['types']) . '"'; |
| 83 | 85 | $where[] = " `type` IN ({$types})"; |
| 84 | 86 | unset($filters['types']); |
| 85 | 87 | } |