public function save(Gyuser_Model_PriorOperations $obj) { $data = array('date' => $obj->getDate(), 'is_operation_completed' => $obj->getIs_operation_completed(), 'cave_name' => $obj->getCave_name(), 'amount' => $obj->getAmount(), 'next_check_date' => $obj->getNext_check_date(), 'pending_checks' => $obj->getPending_checks(), 'is_last_operation' => $obj->getIs_last_operation(), 'next_check_date' => $obj->getNext_check_date()); if (null === ($id = $obj->getId())) { unset($data['id']); $data['client_id'] = $obj->getClient_id(); $id = $this->getDbTable()->insert($data); return $id; } else { $id = $this->getDbTable()->update($data, array('id = ?' => $id)); return $id; } }