From 7be4355001156faed62c71492234cba2c5bf96b4 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Thu, 10 Mar 2011 22:10:05 +0100 Subject: Benutzervewaltung, Gruppenverwaltung, Membershipverwaltung und noch leerer RoleController --- application/models/GroupGroupsMapper.php | 44 +++++++++++++++----------------- 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'application/models/GroupGroupsMapper.php') diff --git a/application/models/GroupGroupsMapper.php b/application/models/GroupGroupsMapper.php index d7f5095..181d12d 100644 --- a/application/models/GroupGroupsMapper.php +++ b/application/models/GroupGroupsMapper.php @@ -2,23 +2,23 @@ class Application_Model_GroupGroupsMapper { - + protected $_dbTable; - public function findBy($criteria, $value) - { - try{ + public function findBy($criteria, $value) + { + try{ $db = Zend_Db_Table::getDefaultAdapter(); - $select = $this->getDbTable()->select() - ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); $stmt = $select->query(); $result = $stmt->fetchAll(); return $result; - }catch (Zend_Exception $e) { - echo "Error message 2: " . $e->getMessage() . "\n"; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; } - } + } public function setDbTable($dbTable) { @@ -31,7 +31,7 @@ class Application_Model_GroupGroupsMapper } $this->_dbTable = $dbTable; - + return $this; } @@ -40,23 +40,19 @@ class Application_Model_GroupGroupsMapper if (null === $this->_dbTable) { $this->setDbTable('Application_Model_DbTable_GroupGroups'); } - + return $this->_dbTable; } public function save(Application_Model_GroupGroups $groupgroups) { - + $data = array('parentID'=> $groupgroups->getParentID() ,'groupID'=> $groupgroups->getGroupID() ); - if (null === ($id = $groupgroups->getID()) ) { - unset($data['groupgroupsID']); - $this->getDbTable()->insert($data); - } else { - $this->getDbTable()->update($data, array('groupgroupsID = ?' => $id)); - } + #Noch zu prüfen ob Eintrag schon vorhanden + $this->getDbTable()->insert($data); } - + public function delete(Application_Model_GroupGroups $groupgroups) { if (null === ($id = $groupgroups->getID()) ) { @@ -74,7 +70,7 @@ class Application_Model_GroupGroupsMapper } $row = $result->current(); - + $groupgroups->setParentID($row->parentID)->setGroupID($row->groupID); } @@ -84,8 +80,8 @@ class Application_Model_GroupGroupsMapper $entries = array(); foreach ($resultSet as $row) { $entry = new Application_Model_GroupGroups(); - - $entry->setParentID($row->parentID)->setGroupID($row->groupID); + + $entry->setParentID($row->parentID)->setGroupID($row->groupID); $entries[] = $entry; } @@ -93,6 +89,6 @@ class Application_Model_GroupGroupsMapper } - + } -- cgit v1.2.3-55-g7522