Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow custom User primary key when logging in #39

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

mvdnes commented Aug 28, 2011

change $user->id to $user->pk()

Contributor

kiall commented Aug 28, 2011

I'm not sure this makes sense - the auth schema includes a FK linking user_tokens.user_id to users.id ..

Can you explain what exactly is not working, I'm betting there is another fix for the issue.

Contributor

mvdnes commented Aug 28, 2011

My Auth_User begins like this

class Model_Lid extends Model_Auth_User {
protected $_primary_key = 'persoon_id';
protected $_table_name = 'leden';
protected $_has_many = array(
'user_tokens' => array(
'model' => 'user_token'
),

so saving fails as there is no id column

@mvdnes mvdnes closed this Aug 28, 2011

@mvdnes mvdnes reopened this Aug 28, 2011

Contributor

kiall commented Aug 28, 2011

Humm - I'm not sure how well auth handles changing its schema around.. It obviously seems to be working for you with this change though!

Can you open a ticket on the tracker and we'll get this merged when we cut a 3.3 branch ..

(Its possible this could be a BC break if there is any possibility of changing _primary_key and leaving this code intact.. if that is not possible, we can probably merge into 3.1/3.2)

Contributor

mvdnes commented Aug 28, 2011

See http://dev.kohanaframework.org/issues/4222
And this is indeed the only thing needed to get a custom primary key working.

Pull request is targetted towards an invalid branch (3.2/master). Usually, this means you have targetted the master, rather than develop branch. Please correct this and try again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment