Welcome Guest, Not a member yet? Register   Sign In
Model Dependency Injection in CodeIgniter Controller - How to Achieve It?
#5

(This post was last modified: 08-09-2023, 06:17 PM by tarcisiodev1.)

(08-09-2023, 05:37 PM)kenjis Wrote: If you really need Dependency Injection, you can install a DI container, and create controllers by the container.
In this case, you need to extend the CodeIgniter class.
See 
- https://github.com/kenjis/ci4-tettei-app...gniter.php
- https://github.com/kenjis/ci4-tettei-app...rvices.php

Thank you very much for the detailed response! This helped me a lot.

(08-09-2023, 11:21 AM)ozornick Wrote: There is no DI container. Autowire is also not.
You need to install dependencies directly  in the method or constructor (new Class or factories). There is a global analog of the Config\Services container

I really appreciate your help
Reply


Messages In This Thread
RE: Model Dependency Injection in CodeIgniter Controller - How to Achieve It? - by tarcisiodev1 - 08-09-2023, 06:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB