Welcome Guest, Not a member yet? Register   Sign In
A helper/class to merge objects preserving structures

I used to make my scripts fully DB based for configuration, When I tried to set the baseURL from the db as the default it does not work on CI4.
Hence, I'm managed now to do so by inheriting the App\Config\App by a custom ones, each one for a purpose, but I could not override the App default values by the DB ones, cause it's loaded with CodeIgniter\CodeIgniter.

I believe if there is a builtin library to merge objects preservings methods , I would use $this->config from routes to overwrite the App and load all needed settings all over with the engine.

All this is to reduce the heavy calls of config(CustomConfigFiles::class) in the baseController or any other common controller

thanks ^^

One potential solution is use a BaseController that merges those settings with an instance of Config\App manually. Then extend all controllers from that BaseController. Then use simply pass the modified config instance into all libraries, and other classes. It's simple, and should work for 99% of your use cases, I would think. With the possible exception of the baseURL.

Theme © iAndrew 2016 - Forum software by © MyBB