Replacing Core Classes Note needed - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: Replacing Core Classes Note needed (/showthread.php?tid=68512) |
Replacing Core Classes Note needed - Martin7483 - 07-20-2017 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/general/core_classes.html#replacing-core-classes It is misleading as you would now expect it to be possible to replace/extend Database classes RE: Replacing Core Classes Note needed - Narf - 07-20-2017 There is a note where it is appropriate: https://www.codeigniter.com/userguide3/general/creating_libraries.html Core classes are the ones located under system/core/, which the DB libs are not. RE: Replacing Core Classes Note needed - Martin7483 - 07-20-2017 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/ RE: Replacing Core Classes Note needed - spjonez - 07-20-2017 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' ); RE: Replacing Core Classes Note needed - Martin7483 - 07-20-2017 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 RE: Replacing Core Classes Note needed - spjonez - 07-20-2017 (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. |