diff options
Diffstat (limited to 'application/models/PoolMapper.php')
| -rw-r--r-- | application/models/PoolMapper.php | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/application/models/PoolMapper.php b/application/models/PoolMapper.php index e2d351a..994a3fd 100644 --- a/application/models/PoolMapper.php +++ b/application/models/PoolMapper.php @@ -5,6 +5,21 @@ class Application_Model_PoolMapper 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)) { @@ -31,7 +46,7 @@ class Application_Model_PoolMapper public function save(Application_Model_Pool $pol) { - + print_a($pol); $data = array('poolID'=> $pol->getID() , 'title'=> $pol->getTitle() , 'description'=> $pol->getDescription() , @@ -63,7 +78,10 @@ class Application_Model_PoolMapper $row = $result->current(); - $pol->setID($row->poolID)->setTitle($row->title)->setDescription($row->description)->setLocation($row->location); + $pol->setID($row->poolID) + ->setTitle($row->title) + ->setDescription($row->description) + ->setLocation($row->location); } public function fetchAll() @@ -80,7 +98,6 @@ class Application_Model_PoolMapper return $entries; } - } |
