diff options
Diffstat (limited to 'application/models/PoolFiltersMapper.php')
| -rw-r--r-- | application/models/PoolFiltersMapper.php | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/application/models/PoolFiltersMapper.php b/application/models/PoolFiltersMapper.php deleted file mode 100644 index 7cc20bb..0000000 --- a/application/models/PoolFiltersMapper.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php - -class Application_Model_PoolFiltersMapper -{ - - protected $_dbTable; - - public function findBy($criteria, $value) - { - try{ - $db = Zend_Db_Table::getDefaultAdapter(); - $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"; - } - } - - 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_PoolFilters'); - } - - return $this->_dbTable; - } - - public function save(Application_Model_PoolFilters $polfilters) - { - - $data = array('poolID'=> $polfilters->getPoolID() ,'filterID'=> $polfilters->getFilterID() ); - - if (null === ($id = $polfilters->getID()) ) { - unset($data['polfiltersID']); - $this->getDbTable()->insert($data); - } else { - $this->getDbTable()->update($data, array('polfiltersID = ?' => $id)); - } - } - - public function delete(Application_Model_PoolFilters $polfilters) - { - if (null === ($id = $polfilters->getID()) ) { - return; - } else { - $this->getDbTable()->delete(array('polfiltersID = ?' => $id)); - } - } - - public function find($id, Application_Model_PoolFilters $polfilters) - { - $result = $this->getDbTable()->find($id); - if (0 == count($result)) { - return; - } - - $row = $result->current(); - - $polfilters->setPoolID($row->poolID)->setFilterID($row->filterID); - } - - public function fetchAll() - { - $resultSet = $this->getDbTable()->fetchAll(); - $entries = array(); - foreach ($resultSet as $row) { - $entry = new Application_Model_PoolFilters(); - - $entry->setPoolID($row->poolID)->setFilterID($row->filterID); - - $entries[] = $entry; - } - return $entries; - } - - - -} - |
