I'm building an application using the Auth module for which I need at least 3 account types : Employer, Employee and Client. Since these accounts have different properties, functions and relationships (ex: employers has_many employees) I guess I need to have them on 3 separate ORM models.
The method I thought was to tweak the Auth module to replace the 'User' model with the appropriate sub-model (employer, employee, client), corresponding the the user type in the database.
Can this be done, or is it bad practice?
For such rurposes you need to create different Model classes for each account type extending default Auth_ORM's Model_User
class.
Then you need to create new Auth_ORM
class extending Kohana_Auth_ORM
class in your application/classes
folder.
In this file you need to rewrite protected _login()
method, so its $user
variable to point to required account type.