summaryrefslogtreecommitdiffstats
path: root/application/models/PoolEntriesMapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/models/PoolEntriesMapper.php')
-rw-r--r--application/models/PoolEntriesMapper.php27
1 files changed, 21 insertions, 6 deletions
diff --git a/application/models/PoolEntriesMapper.php b/application/models/PoolEntriesMapper.php
index 5d92f4c..61e4e0a 100644
--- a/application/models/PoolEntriesMapper.php
+++ b/application/models/PoolEntriesMapper.php
@@ -5,6 +5,21 @@ class Application_Model_PoolEntriesMapper
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)) {
@@ -32,13 +47,13 @@ class Application_Model_PoolEntriesMapper
public function save(Application_Model_PoolEntries $polentries)
{
- $data = array('poolID'=> $polentries->getPoolID() ,'clientID'=> $polentries->getClientID() );
+ $data = array('poolentriesID' => $polentries->getID(), 'poolID'=> $polentries->getPoolID() ,'clientID'=> $polentries->getClientID() );
if (null === ($id = $polentries->getID()) ) {
- unset($data['polentriesID']);
+ unset($data['poolentriesID']);
$this->getDbTable()->insert($data);
} else {
- $this->getDbTable()->update($data, array('polentriesID = ?' => $id));
+ $this->getDbTable()->update($data, array('poolentriesID = ?' => $id));
}
}
@@ -47,7 +62,7 @@ class Application_Model_PoolEntriesMapper
if (null === ($id = $polentries->getID()) ) {
return;
} else {
- $this->getDbTable()->delete(array('polentriesID = ?' => $id));
+ $this->getDbTable()->delete(array('poolentriesID = ?' => $id));
}
}
@@ -60,7 +75,7 @@ class Application_Model_PoolEntriesMapper
$row = $result->current();
- $polentries->setPoolID($row->poolID)->setClientID($row->clientID);
+ $polentries->setID($row->poolentriesID)->setPoolID($row->poolID)->setClientID($row->clientID);
}
public function fetchAll()
@@ -70,7 +85,7 @@ class Application_Model_PoolEntriesMapper
foreach ($resultSet as $row) {
$entry = new Application_Model_PoolEntries();
- $entry->setPoolID($row->poolID)->setClientID($row->clientID);
+ $entry->setID($row->poolentriesID)->setPoolID($row->poolID)->setClientID($row->clientID);
$entries[] = $entry;
}