diff options
Diffstat (limited to 'application/models/BootIsoMapper.php')
| -rw-r--r-- | application/models/BootIsoMapper.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/application/models/BootIsoMapper.php b/application/models/BootIsoMapper.php index c8c4b41..5b3f748 100644 --- a/application/models/BootIsoMapper.php +++ b/application/models/BootIsoMapper.php @@ -5,13 +5,26 @@ class Application_Model_BootIsoMapper protected $_dbTable; - public function findBy($criteria, $value, $array=false) + public function findBy($where, $array=false, $order = false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } $stmt = $select->query(); $result = $stmt->fetchAll(); @@ -26,7 +39,7 @@ class Application_Model_BootIsoMapper }else{ return $result; } - + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } |
