Search code examples
kohana-3kohana-auth

Error when using Auth with ORM driver kohana 3.3.0


today i download a 3.3.0 but have error when working with Auth and ORM :

Fatal error: Class 'Auth_Orm' not found in /home/vsao4/domains/v4.mclub.vn/public_html/modules/auth/classes/Kohana/Auth.php on line 37

My Auth config as below :

'driver'       => 'orm',
'hash_method'  => 'md5',
'hash_key'     => 'secret',
'lifetime'     => 1209600,
'session_type' => Session::$default,
'session_key'  => 'auth_user',

and the code is :

 $ars = array(
                'username'=>'manhquan',
                'password'=>'232323',
                'email'=>'[email protected]'
            );
            if (Auth::instance()->login($ars['username'], $ars['password']))
            {

                    // sucessfully loged
                    $this->response->body('login');

            } else {
                //TODO error
                $this->response->body('not login');
            }

Solution

  • change

    'driver' => 'orm',
    

    to

    'driver' => 'ORM',
    

    Also, there will be an error to Database_Mysql class. Also change your config/database.php file:

    'type' => 'mysql',
    

    to

    'type' => 'MySQL',
    

    This happens due to new Kohana conventions: http://kohanaframework.org/3.3/guide/kohana/conventions