Kohana 3.3 Auth module using not default ORM

257 Views Asked by At

I'm using KOhana 3.3 framework with Doctrine 2 ORM, and finally i have started working on authorisation.

I read about Auth module, but it seems Auth uses default kohana ORM for it's work. I could'n find in source of Auth any code for manipulating with database using ORM. Could you help me to find it?

If it doesn't actually use ORM, maybe i can keep on using Doctrine?

1

There are 1 best solutions below

1
On

The Auth module does not in itself use ORM. It's actually the ORM module that overrides the Auth class. This makes sense because you could have Auth enabled without the ORM module. This is ideally what you want in your situation. You should have the Kohana ORM module disabled, so it doesn't interfere with Doctrine ORM. Then use a module to integrate Doctrine into Kohana. You can build one yourself or there are some already available. e.g:

https://github.com/ingenerator/kohana-doctrine2 https://github.com/stegeman/kohana-doctrine

If for some reason you want to keep Kohana ORM enabled then here's how you can leverage it for auth functions. In the ORM module, it's the Kohana_Auth_ORM class that extends the Auth module's Auth class. So if you override the Auth_ORM class in your application or module folder, that will enable you to replace Auth functions with your Doctrine equivalents.