Alex Foxx Farnsworth
Alex Foxx Farnsworth

Reputation: 237

Fatal Error: Class 'User' not found - Doctrine2/CodeIgniter2

I keep getting the following error when trying to run a login script I have. I have created an Entities folder based on my already in place db schema.

Fatal error: Class 'User' not found in /xxxx/xxxxx/public_html/application/controllers/signup.php on line 23

Code:

    public function __construct() {
        parent::__construct();

        $this->load->helper(array('form','url'));
        $this->load->library('form_validation');
    }

    public function index() {
        $this->load->view('login_form');
    }

    public function submit() {

        if ($this->_submit_validate() === FALSE) {
            $this->index();
            return;
        }

        redirect('/');

    }

    private function _submit_validate() {

        $this->form_validation->set_rules('UserName', 'Username', 
            'trim|required|callback_authenticate');

        $this->form_validation->set_rules('Password', 'Password',
            'trim|required');

        $this->form_validation->set_message('authenticate','Invalid login. Please try again.');

        return $this->form_validation->run();

    }

    public function authenticate() {

        return Current_User::login($this->input->post('UserName'), 
                                    $this->input->post('Password'));

    }
}

Upvotes: 0

Views: 499

Answers (1)

Code Prank
Code Prank

Reputation: 4250

You haven't provide any information abount current_user class. I assume that current_user is your model in that case change the authenticate function to

public function authenticate() {
     $this->load->model('current_user');
     return $this->current_user->login($this->input->post('UserName'), 
                                $this->input->post('Password'));
    }

Upvotes: 3

Related Questions