Replacing Core Classes Note needed |
Hi,
Maybe it is a good idea to have a note added to the documentation regarding the replacement/extention of core Database classes. https://www.codeigniter.com/userguide3/g...re-classes It is misleading as you would now expect it to be possible to replace/extend Database classes
There is a note where it is appropriate: https://www.codeigniter.com/userguide3/g...aries.html
Core classes are the ones located under system/core/, which the DB libs are not.
I knew I had seen it somewhere, just couldn't remenber where
Adding that same note on this page can't hurt https://www.codeigniter.com/userguide3/g...re-classes Seeing as DB libs are also not located in ./system/libraries/
You can extend the core DB libraries if you wish.
application/core/MY_Loader.php: Code: /* overloaded methods */ application/libraries/MY_DB_mysqli_driver.php: Code: <?php if ( !defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
But you can't do that by default. You first need to extend the Loader
And when extending the Loader, or any other class, all you need to do is create a MY_xxxxx.php variant of the file and store it in the correct directory (07-20-2017, 06:23 AM)Martin7483 Wrote: But you can't do that by default. You first need to extend the Loader Correct, the documentation states this Narf linked where above. That doesn't mean you can't only that it isn't available out of the box. The code I posted will allow you to extend them without modifying any core files. |
Welcome Guest, Not a member yet? Register Sign In |