/** * @param Application_Model_Entity_User $user * @return string */ public function signUp(Application_Model_Entity_User $user, $notify, $code = null) { $language = 'en'; try { $locale = new Zend_Locale(Zend_Locale::BROWSER); $language = $locale->getLanguage(); if ($language !== 'de') { $language = 'en'; } } catch (Exception $e) { } $this->_db->insert($this->_table, ['firstName' => $user->getFirstName(), 'lastName' => $user->getLastName(), 'email' => $user->getEmail(), 'password' => $user->getPassword(), 'language' => $language, 'notify' => $notify, 'date' => new Zend_Db_Expr('NOW()'), 'code' => $code]); // get the user's id $user->setId($this->_db->lastInsertId($this->_table)); // insert a dataset with the validation code to the validation table return Application_Model_ValidationRepository::getInstance()->addValidation($user); }
public function addValidation(Application_Model_Entity_User $user) { $code = Application_Model_Hash::hash($user->getEmail()); $this->_db->insert($this->_table, ['code' => $code, 'email' => $user->getEmail()]); return $code; }
public function update(Application_Model_Entity_User $user) { return $this->_db->update($this->_table, ['firstName' => $user->getFirstName(), 'lastName' => $user->getLastName(), 'email' => $user->getEmail(), 'password' => $user->getPassword(), 'role' => $user->getRole()], $this->_db->quoteInto('id=?', $user->getId())); }