CodeIgniter Forums
Using CodeIgniter's DB engine in a non-CI project - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Using CodeIgniter's DB engine in a non-CI project (/showthread.php?tid=38593)



Using CodeIgniter's DB engine in a non-CI project - El Forum - 02-12-2011

[eluser]robustus[/eluser]
I'm using CI for a number of new projects, but I have a few legacy projects that I won't be converting to CI. I do have some libraries that I'd like to use for both, though, and one major issue is the DB calls. If I could use CI's DB layer within a non-CI project, that would very much help portability for me.

Can this be done? Can I move some files around and do the equivalent of $this->load->database() within a non-CI project and get all the DB interaction methods supported in CI? If so, how?

Thanks.


Using CodeIgniter's DB engine in a non-CI project - El Forum - 02-13-2011

[eluser]mi6crazyheart[/eluser]
I think u should have a look on this : http://www.doctrine-project.org/


Using CodeIgniter's DB engine in a non-CI project - El Forum - 02-13-2011

[eluser]Sire[/eluser]
I've thought about this too. A php Active Record class should be pretty useful but if you're determined to use CI's implementation instead this may help:
http://hasin.wordpress.com/2007/06/13/using-activerecord-library-separately-from-codeigniter/

Another post from this forum, with some answers:
http://ellislab.com/forums/viewthread/101097/#759422


Using CodeIgniter's DB engine in a non-CI project - El Forum - 02-15-2011

[eluser]robustus[/eluser]
Ok, thanks. That other thread looks like it has some good info. I'm kinda surprised that so few people apparently have this need, though. It's pretty annoying to use different DB layers in different projects, and I'm sure many people on this board are maintaining both CI and non-CI code.