![]() |
CI and Doctrine - How to reference CI Classes from within Doctrine Class - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: CI and Doctrine - How to reference CI Classes from within Doctrine Class (/showthread.php?tid=22765) Pages:
1
2
|
CI and Doctrine - How to reference CI Classes from within Doctrine Class - El Forum - 09-19-2009 [eluser]iDVB[/eluser] Ok, so maybe what I'm trying to do...I shouldn't even do...but I'm really looking for the right way to do this. I've integrated Doctrine and CI and I have a basic User class like this: Code: <?php the commented line within "checkPassword()" is my issue. I want to use the CI Session class to create a session for that user...however CI does not exist in this class yet. So I tried to include it in the "__construct" like this: Code: public function __construct() but it seems this does not work either? Can anyone offer advice how to get this type of situation to work properly? Cheers CI and Doctrine - How to reference CI Classes from within Doctrine Class - El Forum - 09-21-2009 [eluser]iDVB[/eluser] bump CI and Doctrine - How to reference CI Classes from within Doctrine Class - El Forum - 09-21-2009 [eluser]wiredesignz[/eluser] Try, $session = load_class('Session'); CI and Doctrine - How to reference CI Classes from within Doctrine Class - El Forum - 09-21-2009 [eluser]iDVB[/eluser] Thanks for the reply wiredesignz ... I'll try that. Sorry, just a quick question regarding your suggestion. Is that a quickfix kind of a suggestion or is this what all doctrine/CI users do to reference CI classes from within a doctrine class? Does this mean that I will have to manually include each class and that things such as CI helpers etc are not avail? Cheers CI and Doctrine - How to reference CI Classes from within Doctrine Class - El Forum - 09-21-2009 [eluser]wiredesignz[/eluser] It has nothing to do with Doctrine. Your issue seems to be that the $CI object does not exist yet and cannot be referenced using get_instance(). Using load_class() is the core function used to load libraries for CI itself, so this should work for you also. Other features will be available after the controller ($CI) is instantiated and can be accessed by using get_instance(). CI and Doctrine - How to reference CI Classes from within Doctrine Class - El Forum - 09-21-2009 [eluser]iDVB[/eluser] So this is probably to do with my implementation of Doctrine? Maybe I need to install it into CI as a plugin? CI and Doctrine - How to reference CI Classes from within Doctrine Class - El Forum - 09-21-2009 [eluser]iDVB[/eluser] I guess one of the questions I'm asking is...am I "supposed" to be able to reference CI classes as per normal from within Doctrine classes? So maybe this is just a poor Doctrine implementation on my part? CI and Doctrine - How to reference CI Classes from within Doctrine Class - El Forum - 09-22-2009 [eluser]iDVB[/eluser] bump Is there really no one out there that can offer some tried and true incite into how to integrate Doctrine and CI at a code level as mentioned above? How should/would/could someone have a Doctrine User class/model that can log that user in by using the CI Session Class? CI and Doctrine - How to reference CI Classes from within Doctrine Class - El Forum - 09-22-2009 [eluser]brianw1975[/eluser] I don't understand why you would want to mix and match handling basic user log in. If you want to use CI sessions, then have CI do all of the login functions and pass necessary information to Doctrine to check/validate usernames, passwords, etc and return true/false, etc. what you are doing is like trying to integrate login functions with [phpBB3] and trying to get [phpBB3] to use the CI sessions... CI and Doctrine - How to reference CI Classes from within Doctrine Class - El Forum - 09-22-2009 [eluser]iDVB[/eluser] You bring up a very good point. What I was trying to do was remodel redux_auth so that everything was using doctrine. Since redux_auth had a model that had a login() function I was trying to move that functionality into a doctrine model instead. Hence my proposed solution. Maybe I need to rethink this a bit. Cheers |