kohana / orm

Kohana ORM
159 stars 108 forks source link

Allow custom User primary key when logging in #39

Closed mvdnes closed 13 years ago

mvdnes commented 13 years ago

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

kiall commented 13 years ago

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.

mvdnes commented 13 years ago

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

kiall commented 13 years ago

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)

mvdnes commented 13 years ago

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

Kohana-Builds commented 13 years ago

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!