public function widgetsave(User_Model_Guest $customer) { $db = Zend_Db_Table::getDefaultAdapter(); $userMapper = new User_Model_ClientDataMapper(); try { $db->beginTransaction(); $userId = $userMapper->save($customer); $customer->setUserid($userId); $data = array('cusfk_user' => $customer->getUserid(), 'cusfirst_name' => $customer->getFirstname(), 'cuslast_name' => $customer->getLastname()); $customer_id = $this->getDbTable()->insert($data); $db->commit(); return $customer_id; } catch (Exception $ex) { $db->rollBack(); throw new Exception($ex->getMessage()); } }
public function save(User_Model_Manager $restaurantowner, $source = 'DD') { $db = Zend_Db_Table::getDefaultAdapter(); $userMapper = new User_Model_ClientDataMapper(); try { $db->beginTransaction(); $userId = $userMapper->save($restaurantowner); $restaurantowner->setUserid($userId); $data = array('rsofirst_name' => $restaurantowner->getFirstName(), 'rsolast_name' => $restaurantowner->getLastName(), 'rsofk_user' => $restaurantowner->getUserid(), 'rsorestaurant_name' => $restaurantowner->getRestaurantname(), 'rsodescription' => $restaurantowner->getDescription(), 'rsowebsite' => $restaurantowner->getWebsite(), 'rsocantfind' => $restaurantowner->getCantFind(), 'rsocity' => $restaurantowner->getcity(), 'rsozipcode' => $restaurantowner->getzipCode()); if ($restaurantowner->getPhonenumber()) { $data['rsophone'] = $restaurantowner->getPhonenumber(); } if ($restaurantowner->getCountryCode()) { $data['rsocountrycode'] = $restaurantowner->getCountryCode(); } if ($restaurantowner->getDateofbirth()) { $data['rsodob'] = $restaurantowner->getDateofbirth(); } if ($restaurantowner->getCantFind() == 1) { $data['rsostateid'] = $restaurantowner->getStateid(); $data['rsoregionid'] = $restaurantowner->getRegionid(); $data['rsoyourcity'] = $restaurantowner->getCantFindCity(); } else { if ($restaurantowner->getCantFind() == 2) { $data['rsostateid'] = $restaurantowner->getStateid(); $data['rsoyourregion'] = $restaurantowner->getCantFindRegion(); $data['rsoyourcity'] = $restaurantowner->getCantFindCity(); } else { if ($restaurantowner->getCantFind() == 3) { $data['rsoyourstate'] = $restaurantowner->getCantFindState(); $data['rsoyourregion'] = $restaurantowner->getCantFindRegion(); $data['rsoyourcity'] = $restaurantowner->getCantFindCity(); } else { if ($restaurantowner->getCantFind() == 0 || $restaurantowner->getCantFind() == '') { $data['rsostateid'] = $restaurantowner->getStateid(); $data['rsocityid'] = $restaurantowner->getCityid(); $data['rsoregionid'] = $restaurantowner->getRegionid(); } } } } if ($restaurantowner->getSourceid()) { $data['rsosourceid'] = $restaurantowner->getSourceid(); if ($restaurantowner->getSourcedescription()) { $data['rsosourcedescription'] = $restaurantowner->getSourcedescription(); } } if ($restaurantowner->getCompanyid()) { $data['rso_companyid'] = $restaurantowner->getCompanyid(); } $res_own_id = $this->getDbTable()->insert($data); $db->commit(); if ($source == 'DD') { return $userId; } else { $query = $this->getDbTable()->select(); $query->setIntegrityCheck(false); $query->from(array('usr' => 'rd.user'), array('usrid', 'usremail', 'usrpassword', 'usrusertype_id', 'usrrole_id', 'usrregistered_date', 'usrlastlogged_in_ip', 'usrlast_login_date', 'usruser_status_id', 'usrcreatedby', 'usrcreateddatetime', 'usrupdatedby', 'usrupdateddatetime', 'usrpassphrase', 'usripaddress'))->where('usrid = ?', $userId); return $this->getDbTable()->fetchRow($query); } } catch (Exception $ex) { $db->rollBack(); throw new Exception($ex->getMessage()); } }