public function fetchAll() { $table = $this->getDbTable(); $select = $table->select(); $select->from($table, array('id', 'name')); $select->where('status = ?', true); $resultSet = $table->fetchAll($select); $entries = array(); foreach ($resultSet as $row) { $entry = new Gyuser_Model_Colegas(); $entry->setId($row->id); $entry->setName($row->name); $entries[] = $entry; } return $entries; }
public function addnewcolegaajaxAction() { try { $request = $this->getRequest(); if ($this->getRequest()->isPost()) { //$mapper = new Gyuser_Model_OtherCavesDataMapper (); //$Obj = new Gyuser_Model_OtherCaves (); $mapper = new Gyuser_Model_ColegasDataMapper(); $Obj = new Gyuser_Model_Colegas(); $Obj->setId($request->id); $Obj->setName($request->name); $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $id = $mapper->save($Obj); if ($id) { echo $id; } else { echo "f"; } } } catch (Exception $e) { echo $e; } }