summaryrefslogtreecommitdiffstats
path: root/application/models/GroupGroupsMapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/models/GroupGroupsMapper.php')
-rw-r--r--application/models/GroupGroupsMapper.php44
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
}
-
+
}