diff options
author | michael pereira | 2011-04-01 13:56:29 +0200 |
---|---|---|
committer | michael pereira | 2011-04-01 13:56:29 +0200 |
commit | 2dd4004af95ab7e11813281c19a7e32aa0119e5a (patch) | |
tree | 91293df21ae0bc44a2848306d037e6a288a6d711 /application/models | |
parent | bootos controller fertig (diff) | |
download | pbs2-2dd4004af95ab7e11813281c19a7e32aa0119e5a.tar.gz pbs2-2dd4004af95ab7e11813281c19a7e32aa0119e5a.tar.xz pbs2-2dd4004af95ab7e11813281c19a7e32aa0119e5a.zip |
bootmenu
Diffstat (limited to 'application/models')
-rw-r--r-- | application/models/BootMenuMapper.php | 16 | ||||
-rw-r--r-- | application/models/BootOsMapper.php | 19 |
2 files changed, 25 insertions, 10 deletions
diff --git a/application/models/BootMenuMapper.php b/application/models/BootMenuMapper.php index e26a9e1..c8065ec 100644 --- a/application/models/BootMenuMapper.php +++ b/application/models/BootMenuMapper.php @@ -5,7 +5,7 @@ class Application_Model_BootMenuMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($criteria, $value, $array=false) { try{ $db = Zend_Db_Table::getDefaultAdapter(); @@ -14,7 +14,19 @@ class Application_Model_BootMenuMapper ->where($criteria . ' = ?', $value); $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_BootMenu($row); + $entry->setID($row['bootmenuID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/BootOsMapper.php b/application/models/BootOsMapper.php index 74fced0..3ac2a8c 100644 --- a/application/models/BootOsMapper.php +++ b/application/models/BootOsMapper.php @@ -5,7 +5,7 @@ class Application_Model_BootOsMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($criteria, $value, $array=false) { try{ $db = Zend_Db_Table::getDefaultAdapter(); @@ -15,15 +15,18 @@ class Application_Model_BootOsMapper $stmt = $select->query(); $result = $stmt->fetchAll(); - $entries = array(); - foreach ($result as $row) { - $entry = new Application_Model_BootOs($row); - $entry->setID($row['bootosID']); - $entries[] = $entry; + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_BootOs($row); + $entry->setID($row['bootosID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; } - return $entries; - }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } |