_dbTable = $dbTable; return $this; } public function getDbTable() { if (null === $this->_dbTable) { $this->setDbTable('Application_Model_DbTable_Group'); } return $this->_dbTable; } public function save(Application_Model_Group $group) { $data = array('groupID'=> $group->getID() ,'title'=> $group->getTitle() ,'description'=> $group->getDescription() ); if (null === ($id = $group->getID()) ) { unset($data['groupID']); $this->getDbTable()->insert($data); } else { $this->getDbTable()->update($data, array('groupID = ?' => $id)); } } public function delete(Application_Model_Group $group) { if (null === ($id = $group->getID()) ) { return; } else { $this->getDbTable()->delete(array('groupID = ?' => $id)); } } public function find($id, Application_Model_Group $group) { $result = $this->getDbTable()->find($id); if (0 == count($result)) { return; } $row = $result->current(); $group->setID($row->groupID)->setTitle($row->title)->setDescription($row->description); } public function fetchAll() { $resultSet = $this->getDbTable()->fetchAll(); $entries = array(); foreach ($resultSet as $row) { $entry = new Application_Model_Group(); $entry->setID($row->groupID)->setTitle($row->title)->setDescription($row->description); $entries[] = $entry; } return $entries; } }