diff options
| author | michael pereira | 2011-03-07 17:54:01 +0100 |
|---|---|---|
| committer | michael pereira | 2011-03-07 17:54:01 +0100 |
| commit | f122bafccf6a81b87d982956f615e70ceaecfeb3 (patch) | |
| tree | 98e9960b2fda10f29765d3382d7fd92cfc100f92 /application/models/PoolMapper.php | |
| parent | BootMenuEntries fertig (diff) | |
| parent | dirty hack entfertn durch findBy-Methode (diff) | |
| download | pbs2-f122bafccf6a81b87d982956f615e70ceaecfeb3.tar.gz pbs2-f122bafccf6a81b87d982956f615e70ceaecfeb3.tar.xz pbs2-f122bafccf6a81b87d982956f615e70ceaecfeb3.zip | |
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
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; } - } |
