• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Access CodeIgniter Database Class directly

Does anyone have tips on how to access the CodeIgniter database classes/functions directly? I am working with PHPUnit and trying to test some of my classes that depend on

$CI =& get_instance();

It's not actually like that, because I use dependency injection to put the database into each class ... but in princple I need access to the fully instantiated class normally referenced by:


I don't need the rest of the MVC framework, just the database functionality. I have tried things like requiring just the config/database.php file, and the system/database/DB.php, and working with that ... but it seems everything is so woven together I can't access the database without loading the entire framework. Gah!

Am I up !@#% creek? Looking forward to ideas/responses.

Have no idea if it works or not...it's also old but might point you in the right direction...

Hi CroNiX, yeah I finally figured out something very similar to that. I would say that pretty much solves the issue. I was able to get it to work.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.