From 07e3636f3ef4a666db0fefbc1663bf6c1e10b996 Mon Sep 17 00:00:00 2001 From: michael pereira Date: Tue, 8 Feb 2011 13:18:06 +0100 Subject: MapperScript & Mapper angelegt (alle die einen Primärschlüssel besitzen) --- createDefaultMapper/mappertemplate | 75 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 createDefaultMapper/mappertemplate (limited to 'createDefaultMapper/mappertemplate') diff --git a/createDefaultMapper/mappertemplate b/createDefaultMapper/mappertemplate new file mode 100644 index 0000000..f994184 --- /dev/null +++ b/createDefaultMapper/mappertemplate @@ -0,0 +1,75 @@ +_dbTable = $dbTable; + + return $this; + } + + public function getDbTable() + { + if (null === $this->_dbTable) { + $this->setDbTable('Application_Model_DbTable_Person'); + } + + return $this->_dbTable; + } + + public function save(Application_Model_MODEL $MVAR) + { + + $data = array(SAVEDATA); + + if (null === ($id = $MVAR->getID()) ) { + unset($data['id']); + $this->getDbTable()->insert($data); + } else { + $this->getDbTable()->update($data, array('id = ?' => $id)); + } + } + + public function find($id, Application_Model_MODEL $MVAR) + { + $result = $this->getDbTable()->find($id); + if (0 == count($result)) { + return; + } + + $row = $result->current(); + + $MVARFIND; + } + + public function fetchAll() + { + $resultSet = $this->getDbTable()->fetchAll(); + $entries = array(); + foreach ($resultSet as $row) { + $entry = new Application_Model_MODEL(); + + $entryFIND; + + $entries[] = $entry; + } + + return $entries; + } + + + +} + -- cgit v1.2.3-55-g7522