简体   繁体   中英

Kohana 3.3 Auth module using not default ORM

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?

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. eg:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM