johnmerlino Posted March 6, 2011 Share Posted March 6, 2011 Hey all, Using codeigniter, I create a new user object and grab the user input (email and password) from a form: public function signup(){ $this->template->render_content('template', '/users/signup'); $user = new User($this->input->post('email'),$this->input->post('password')); if($_SERVER['REQUEST_METHOD'] == 'POST'){ if($user.save()){ redirect('/home/index', 'refresh'); } else{ redirect('/users/login', 'refresh'); } } } The constructor function of user model assigns the user input to this object: public function __construct($email,$password){ $this->email = $email; $this->password = $password; } By using the __get and __set magic method, this calls two setter methods: public function setEmail($email){ if ( ! is_null( $email ) ) { $this->_email = $email; } return null; } public function setPassword($password){ if ( ! is_null( $password ) ) { User::$password_salt = User::randomize(); User::$encrypted_password = User::encrypt($this->password,User::$password_salt); } return null; } I clearly pass two arguments when instantiating user. Yet I get this error message: Message: Missing argument 1 for User::__construct() Thanks for response. Can someone move this to the general help forum? I meant to submit it there. Thanks. Link to comment https://forums.phpfreaks.com/topic/229780-message-missing-argument-1missing-argument-2-for-user__construct/ Share on other sites More sharing options...
johnmerlino Posted March 6, 2011 Author Share Posted March 6, 2011 I took care of the missing arguments issue. But now codeigniter tells me this: Indirect modification of overloaded property User::$_ci_scaffolding has no effect Filename: libraries/Model.php Link to comment https://forums.phpfreaks.com/topic/229780-message-missing-argument-1missing-argument-2-for-user__construct/#findComment-1183668 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.