diff options
author | Simon | 2011-03-05 17:41:24 +0100 |
---|---|---|
committer | Simon | 2011-03-05 17:41:24 +0100 |
commit | 3a57892f9145bfadac4cf3bf4392020f99e0d541 (patch) | |
tree | 9e22a2749ae1713f4cc10395555d5757f6e52a36 /application/models/FilterEntriesMapper.php | |
parent | Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff) | |
download | pbs2-3a57892f9145bfadac4cf3bf4392020f99e0d541.tar.gz pbs2-3a57892f9145bfadac4cf3bf4392020f99e0d541.tar.xz pbs2-3a57892f9145bfadac4cf3bf4392020f99e0d541.zip |
filter-oberffäche fertig, nun zur auswahl des bootmenus && funktion toArray bei jedem Mapper hinzugefügt, um populate bei Formularen nutzen zu können
Diffstat (limited to 'application/models/FilterEntriesMapper.php')
-rw-r--r-- | application/models/FilterEntriesMapper.php | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/application/models/FilterEntriesMapper.php b/application/models/FilterEntriesMapper.php index 54d6e3a..ef2c28f 100644 --- a/application/models/FilterEntriesMapper.php +++ b/application/models/FilterEntriesMapper.php @@ -31,20 +31,31 @@ class Application_Model_FilterEntriesMapper public function save(Application_Model_FilterEntries $filterentries) { - + try{ $data = array('filterID'=> $filterentries->getFilterID() , 'filtertypeID'=> $filterentries->getFiltertypeID() , 'filtervalue'=> $filterentries->getFiltervalue() , 'filtervalue2'=> $filterentries->getFiltervalue2() ); - - if (null != ($id1 = $filterentries->getFilterID()) && - null != ($id2 = $filterentries->getFiltertypeID()) && - $this->getDbTable()->find($filterentries->getFilterID(),$filterentries->getFiltertypeID())) { + + $filterentries2 = new Application_Model_FilterEntries(); + $result = $this->find($filterentries->getFilterID(),$filterentries->getFiltertypeID(),$filterentries2); + echo "<pre style='border:1px solid black;background-color:#F5B800'>"; + print_r(array($filterentries,$filterentries2,$result)); + echo "</pre>"; + $id1 = $filterentries->getFilterID(); + $id2 = $filterentries->getFiltertypeID(); + if (0 == count($result) && + null != $id1 && + null != $id2) { $this->getDbTable()->insert($data); - echo 'fall1'; + echo 'inserted'; } else { - $this->getDbTable()->update($data, array('filterID = ?' => $id1, 'filtertypeID = ?' => $id2)); - echo 'fall2'; + print_r($this->getDbTable()->update($data, array('filterID = ?' => $id1, 'filtertypeID = ?' => $id2))); + echo 'updated'; + } + + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; } } @@ -53,13 +64,18 @@ class Application_Model_FilterEntriesMapper try{ $id1 = $filterentries->getFilterID(); $id2 = $filterentries->getFiltertypeID(); + echo "<pre>"; + echo "-----------\n"; var_dump(array($id1,$id2)); + echo "</pre>"; //TODO: Löschen klappt nicht - if ((null != $id1) && (null != $id2) && + if ((null == $id1) && (null == $id2) && $this->getDbTable()->find($filterentries->getFilterID(),$filterentries->getFiltertypeID())) { + echo 'case1'; return; } else { $this->getDbTable()->delete(array('filterID = ?' => $id1, 'filtertypeID = ?' => $id2)); + echo 'case2'; } }catch (Zend_Exception $e) { |