Welcome Guest, Not a member yet? Register   Sign In
porting CI3 base controller to CI4 -- __construct vs initController
#7

(This post was last modified: 12-11-2020, 03:00 AM by tgix. Edit Reason: Updated github link )

Thank you for an interesting and delightful discussion!

(12-10-2020, 01:58 PM)sneakyimp Wrote: Thank you for the clarification. I've read that page on Filters and am not sure I'm convinced that using filters for authentication is all that great.

(12-10-2020, 01:58 PM)sneakyimp Wrote: I'm curious to see how CI4's OOP is "cleaner." So far, I see a lot of cumbersome namespacing and a lot of ways it breaks your CI3 project.

While enjoying my morning coffee I put together a more detailed description of my CI4 back-end and how I have implemented the filters. I am not a blog-artist so it's here in github - https://github.com/tangix/ci4-zen-zone/t...ng-filters

Maybe a start as a blogger, who knows?

I have been living in PHP 5.x for too long and since CI3 didn't "force" me to use OOP I didn't. I have come to appreciate traits, interfaces and namespacing as it makes the code cleaner and more robust. For my development i use PHPStorm and find many of the code-navigation and -completion functions very helpful.

(12-10-2020, 01:58 PM)sneakyimp Wrote: I really appreciate your explaining this, but it'll take me some time to absorb. In my CI3 project, I didn't hesitate to make model classes that combine the atomic, db-based model classes using Aggregation/Composition/Association. I basically had two types of model classes:
1) auto-generated DB_x classes, one for every db table, which are basic-but-extensible interfaces to my database. I wrote a script to read my db and automatically create one class for every table.
2) ad-hoc model classes as needed to combine the db classes into my business logic.
In my project described above I am using Entities extensively to transform data between front- and back-end. Many of the UI elements for example use JSON arrays for multi-pickers. I have created by own BaseEntity handling casts between arrays (from the front-end) and comma separated strings (stored in the database). The map directly

(12-10-2020, 01:58 PM)sneakyimp Wrote: Do it! The world can always use more discourse and illustrations of coding techniques.
First step taken - https://github.com/tangix/ci4-zen-zone
Reply


Messages In This Thread
RE: porting CI3 base controller to CI4 -- __construct vs initController - by tgix - 12-11-2020, 02:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB