Load token throws Database_Exception
Closed this issue · 2 comments
With sprig & sprig-auth master branch.
Database_Exception [ 1054 ]: Unknown column 'user_tokens.user_' in 'field list'
[ SELECT `user_tokens`.`id`, `user_tokens`.`token`, `user_tokens`.`user_` AS
`user`, `user_tokens`.`user_agent`, `user_tokens`.`created`, user_tokens`.`expires`
FROM `user_tokens` WHERE `user_tokens`.`token` =
'pN6YMA9WDizu3ZSJZ1ui8j4EdANRve5z' LIMIT 1 ]
I'm getting the exception calling this:
Auth::instance()->logged_in()
If I change the field 'user' in Model_Auth_User_Token adding the property 'in_db' to FALSE, the problem "dissapears".
Not sure what is happening here. This is likleydue to a change in Sprig - I haven't tested the current code since Shadowhand last made changes. It looks like the foreign key field for the belongs to relaitonship isn't being set peroperly - no idea why.
in_db = FALSE may stop this exception but it will also mean the relationship between the token and the user breaks.
Sorry banks, the fail was mine :-(
I extended Model_Auth_User, but I forgot to call parent::_init. Doing that resolves the problem.
Again, sorry for the inconvenience.
PS: now I get another error "Column 'logins' cannot be null" when trying to create the user, but maybe it's mine again... so no issue this time!! ;)