diff options
| author | Björn Geiger | 2011-03-10 22:10:05 +0100 |
|---|---|---|
| committer | Björn Geiger | 2011-03-10 22:10:05 +0100 |
| commit | 7be4355001156faed62c71492234cba2c5bf96b4 (patch) | |
| tree | 55bb96227ee354cc0c6d6788dc45020bd43d8bba /application/models/GroupGroupsMapper.php | |
| parent | Merge branch 'master' of ssh://git.openslx.org/lsfks/master-teamprojekt/pbs2 (diff) | |
| download | pbs2-7be4355001156faed62c71492234cba2c5bf96b4.tar.gz pbs2-7be4355001156faed62c71492234cba2c5bf96b4.tar.xz pbs2-7be4355001156faed62c71492234cba2c5bf96b4.zip | |
Benutzervewaltung, Gruppenverwaltung, Membershipverwaltung und noch leerer RoleController
Diffstat (limited to 'application/models/GroupGroupsMapper.php')
| -rw-r--r-- | application/models/GroupGroupsMapper.php | 44 |
1 files changed, 20 insertions, 24 deletions
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 } - + } |
