Comments (6)
Makes sense, especially the query analysis with explain ... that has been a can of worms in CI3.
from codeigniter4.
Instead of refactoring most of the Database class, why not use Traits instead? Laravel seems to have no trouble putting a lot of new features via Traits.
from codeigniter4.
Hope this helps http://symfony.com/doc/current/components/event_dispatcher.html
from codeigniter4.
Hooks in CI have been changed quite a bit since v3 so it's good to go. Though I've been considering modifying to use an extra class as the "package" like Laravel does, but only because the class forms a contract so all listeners know exactly what's there. Haven't decided if that's happening or not, yet.
As for refactoring - it's a tiny refactor that's needed. Instead of saving the query you broadcast and event with the query as the payload. That's all that would have to change there. The Toolbar's Database portion would need to be modified, but that's no biggie. Part of me thinks all toolbar collectors should have event listeners to grab their info from, but I'm undecided on that part, also, if just for the performance hit, but that would likely be offset by memory and storage considerations that wouldn't be necessary in production.
The flexibility of having these converted to events, though, instead of saving the debug info, could be huge. People could create all sorts of things that work with them, form a simple "slow log" collector that is db-agnostic, to simply displaying all queries in STDOUT so you could watch, or any number of other things I haven't really thought of yet. Seems very promising.
As for Taylor's love of traits - I personally think he uses too many and could probably allow a number of them to be composed into the class as class instances instead of traits and be better off. But that wouldn't provide the magical use-case he's so fond of. The way I've been taught and seen for myself a bit, is that an over-reliance of traits is bad, if only in part because of the way inheritance and method overriding works when you start combining traits and inherited classes, etc. Traits have their uses, and I believe we have one or two currently, but I don't personally believe they're the magic bullet that Taylor does.
from codeigniter4.
This is what I said at the start of CI 4 that an event system should be built into it even the ci system could use it., I have to agree with you on over doing traits etc;
from codeigniter4.
I'm not sure if that's all of it, but there are actually a few Traits in laravel https://laravel.com/api/5.3/traits.html. and yes, i do love events too!
from codeigniter4.
Related Issues (20)
- Bug: Credit card validation does not work with multiple card HOT 1
- Bug: postgre can not connect to database error HOT 12
- `Model::paginate()` behavior when `$page` exceeds the last page HOT 12
- Bug: CodeIgniter v4.5.1 When I connect Postgres Database I Received Error HOT 4
- Bug: [Error] Call to undefined method Config\Mimes::__set_state() at ROOTPATH/writable/cache/FactoriesCache_config HOT 7
- Bug: [DebugBar] Flush a session flash-data when redirect by "Refresh" method HOT 2
- Add required_if validation rules
- Bug: Entity Standalone Class initialization error HOT 2
- Bug: How can I know which browser name is the request from?
- Bug: How can I know which browser name is the request from? HOT 14
- Bug: storing validation rules in Config/Validation causes error HOT 1
- Bug: Fatal error: Uncaught Error: Undefined constant "ENVIRONMENT" in /var/www/html/MyApp/system/Common.php:777 HOT 1
- Bug: cannot run PHPUnit testing in CI 4.5.1 appstarter HOT 5
- "Deploy API Documentation" fails HOT 1
- Composer PSR-4 notices "does not comply with psr-4 autoloading standard" HOT 16
- Bug: CodeIgniter\Router\RouteCollection::getRoutesOptions(): Argument #1 ($from) must be of type ?string, int given, called in system\Router\DefinedRouteCollector.php on line 49 HOT 3
- Bug: `migrate:rollback -b` impossible due to TypeError HOT 4
- Bug: [Validation] if_exist is not working as intended with arrays HOT 1
- Bug: spark routes doesn't work with `(.+)` HOT 2
- Bug: nested $routes->group() with same filter name doesn't work as exepcted HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codeigniter4.