summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authormentos2011-01-31 10:20:48 +0100
committermentos2011-01-31 10:20:48 +0100
commitc2480358cf792cc2abd434e471a85ffba55318af (patch)
tree3e6eff9dd9d7e2c3bb420beadff2cfba48be032d /application
parentsetter/getter geändert damit es Konvention setGrossbuchstabe() entspricht (diff)
downloadpbs2-c2480358cf792cc2abd434e471a85ffba55318af.tar.gz
pbs2-c2480358cf792cc2abd434e471a85ffba55318af.tar.xz
pbs2-c2480358cf792cc2abd434e471a85ffba55318af.zip
some fixes
Diffstat (limited to 'application')
-rw-r--r--application/models/BootIso.php2
-rw-r--r--application/models/BootMenuEntries.php6
-rw-r--r--application/models/BootMenuEntriesMapper.php77
3 files changed, 83 insertions, 2 deletions
diff --git a/application/models/BootIso.php b/application/models/BootIso.php
index 3a411db..ce38fde 100644
--- a/application/models/BootIso.php
+++ b/application/models/BootIso.php
@@ -2,7 +2,7 @@
class Application_Model_BootIso
{
- protected $_bootisoID
+ protected $_bootisoID;
protected $_membershipID;
protected $_groupID;
protected $_serialnumber;
diff --git a/application/models/BootMenuEntries.php b/application/models/BootMenuEntries.php
index 3bb05ea..8e86ace 100644
--- a/application/models/BootMenuEntries.php
+++ b/application/models/BootMenuEntries.php
@@ -2,6 +2,12 @@
class Application_Model_BootMenuEntries
{
+ protected $_bootosID;
+ protected $_bootmenuID;
+ protected $_title;
+ protected $_kcl;
+ protected $_order;
+
public function __construct(array $options = null)
{
if (is_array($options)) {
diff --git a/application/models/BootMenuEntriesMapper.php b/application/models/BootMenuEntriesMapper.php
index ed13180..576e799 100644
--- a/application/models/BootMenuEntriesMapper.php
+++ b/application/models/BootMenuEntriesMapper.php
@@ -1,8 +1,83 @@
<?php
-class Application_Model_BootMenuEntriesMapper
+class Application_Model_BootEntriesMapper
{
+ protected $_dbTable;
+ public function setDbTable($dbTable)
+ {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable()
+ {
+ if (null === $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_TABLENAME');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_TABLENAME $tablenamevar)
+ {
+
+ $data = array(
+ 'bootosID' => $tablenamevar->getBootosID(),
+ 'bootmenuID' => $tablenamevar->getMenuID(),
+ 'title' => $tablenamevar->getTitle(),
+ 'kcl' => $tablenamevar->getKcl(),
+ 'order' => $tablenamevar->getOrder()
+ );
+
+ if (null === ($id = $tablenamevar->getId()) ) {
+ unset($data['id']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('id = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_TABLENAME $tablenamevar)
+ {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $tablenamevar->setId($row->id)
+ ->setEmail($row->email)
+ ->setComment($row->comment)
+ ->setCreated($row->created);
+ }
+
+ public function fetchAll()
+ {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_TABLENAME();
+
+ $entry->setId($row->id)
+ ->setEmail($row->email)
+ ->setComment($row->comment)
+ ->setCreated($row->created);
+
+ $entries[] = $entry;
+ }
+
+ return $entries;
+ }
}