summaryrefslogtreecommitdiffstats
path: root/application/models/BootMenuMapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/models/BootMenuMapper.php')
-rw-r--r--application/models/BootMenuMapper.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/application/models/BootMenuMapper.php b/application/models/BootMenuMapper.php
index c8065ec..60c506d 100644
--- a/application/models/BootMenuMapper.php
+++ b/application/models/BootMenuMapper.php
@@ -5,13 +5,28 @@ class Application_Model_BootMenuMapper
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();