php - Kohana Model_Auth_User_Token not getting overridden -


pdo doesn't support list_columns function. around when using pdo kohana's auth module, have list table names array keys in extension of model class, thusly:

<?php defined('syspath') or die('no direct script access');  class model_user extends model_auth_user {     protected $_has_many = array(             'roles' => array(                     'through' => 'roles_users',                     'foreign_key' => 'user_id',                     'far_key' => 'role_id'             )     );     protected $_table_columns = array(         'id' => null,         'username' => null,         'password' => null,         'email' => null,         'logins' => null,         'last_login' => null     ); } 

however, user_tokens model class returning true empty($this->_table_columns), causing kohana attempt call list_columns, throws exception.

on same page load, both users model class , roles model class behaving intended; process hiccuping when hit user_tokens. did digging, using var_dump check on things; first hint adding property model class didn't show in vardump. after more digging, dropped in call reflectionclass::getfilename make sure implementation of class being used.

the results produced apppath\classes\model\user.php users model class, apppath\classes\model\role.php roles model class... hit modpath\orm\classes\model\user\token.php user_tokens model class!

there little different between implementation of 3 models beyond actual columns being used. users implementation above, , here roles , user_tokens implementations:

<?php defined('syspath') or die('no direct script access');  class model_role extends model_auth_role {     protected $_table_columns = array(         'id' => null,         'name' => null,         'description' => null     ); } 
<?php defined('syspath') or die('no direct script access');  class model_user_token extends model_auth_user_token {     protected $_table_columns = array(             'id' => null,             'user_id' => null,             'user_agent' => null,             'token' => null,             'created' => null,             'expires' => null     ); } 

and here's version of model_user_token modpath:

<?php defined('syspath') or die('no direct access allowed.');  class model_user_token extends model_auth_user_token {      // class can replaced or extended  } // end user token model 

i don't understand why application pulling model_user_token modpath instead of apppath, especially when model_user , model_role getting picked correctly (modpath contains empty implementations of both).

how can kohana pick application version of class, instead of module version of class?

you have follow kohana autoloader's naming convention guidelines in order find file. can vary depending on version of kohana:

for kohana <= 3.2

the class class my_class_name {} should in file named classes/my/class/name.php within apppath directory (all lowercase directories , file names underscores replaced /).

for kohana >= 3.3

the class class my_class_name {} should in file named classes/my/class/name.php within apppath directory (psr-0 format, underscores replaced / , directories , file names match class name case).


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -