CodeIgniter Forums
CI4 Db - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: CI4 Db (/showthread.php?tid=71171)



CI4 Db - scalla - 07-15-2018

Can I extend the ci4 db classes??


RE: CI4 Db - kilishan - 07-15-2018

Theoretically, yes, though it could get pretty tricky now that I think about it. What are you trying to do?


RE: CI4 Db - scalla - 07-15-2018

I want alert the aggregator methods and also add new methods to suit my project.


RE: CI4 Db - kilishan - 07-15-2018

Adding methods is probably better done in a new base Model class, I would think.

As for anything more complex, I think you'll basically have to setup an entire set of Handlers, like you were setting up a new database the system knew about. That would include Builder, Connection, Forge, PreparedQuery, and Result classes. Each of those would just extend the MySQLi or Postgre files, per your need. This is needed, unfortunately, due to the way that class files are loaded within the database system. Kind of a pain, and probably something that needs to be looked into at some point.


RE: CI4 Db - scalla - 07-15-2018

??? what I intend, is not expected to be restrictive to model only. And an entirely new handler, that's pained. I would have to modify session class and others where db is used..


RE: CI4 Db - scalla - 07-15-2018

(07-15-2018, 09:32 PM)kilishan Wrote: Kind of a pain, and probably something that needs to be looked into at some point.

yes it does. While looking at the database classes yesterday, the configuration implementation isn't fair. I understand the point if trying to use Database:::connect, Database::forge etc else it would have been cul adding it to the services.


RE: CI4 Db - kilishan - 07-16-2018

(07-15-2018, 10:30 PM)scalla Wrote: yes it does. While looking at the database classes yesterday, the configuration implementation isn't fair. I understand the point if trying to use Database:::connect, Database::forge etc else it would have been cul adding it to the services.

Not sure I understand what you mean. How is the implementation "not fair"?


RE: CI4 Db - scalla - 07-16-2018

I mean the /config/Database, if it were just Services:Big Grinatabase, it would be easy