Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is the createAction
- if ($userForm->isValid($_POST)) {
- $userModel = new Model_User();
- $userModel->createUser(
- $userForm->getValue('email'),
- $userForm->getValue('password'),
- $userForm->getValue('url'),
- $userForm->getValue('responsable'),
- $userForm->getValue('role')
- );
- $paises = $this->getRequest()->getParam('pais');
- $userId = //what should I have here??
- return $this->_forward('list');
- }
- //and this is the model
- class Model_User extends Zend_Db_Table_Abstract {
- /**
- * The default table name
- */
- protected $_name = 'users';
- public function createUser($email, $password, $url, $responsable, $role)
- {
- // create a new row
- $rowUser = $this->createRow();
- if($rowUser) {
- // update the row values
- $rowUser->email = $email;
- $rowUser->password = md5($password);
- $rowUser->url = $url;
- $rowUser->responsable = $responsable;
- $rowUser->role = $role;
- $rowUser->save();
- //return the new user
- return $rowUser;
- } else {
- throw new Zend_Exception("El usuario no se ha podido crear!");
- }
- }
- }
Add Comment
Please, Sign In to add comment