致命错误:未找到“用户”类 - Doctrine2 / CodeIgniter2

时间:2012-03-19 20:46:19

标签: doctrine-orm codeigniter-2

尝试运行我的登录脚本时,我一直收到以下错误。我已根据已有的db模式创建了一个Entities文件夹。

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

代码:         

    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'));

    }
}

1 个答案:

答案 0 :(得分:3)

您尚未提供任何信息abount current_user类。我假设current_user是你的模型,在这种情况下将authenticate函数更改为

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