Use namespaces in Codeigniter 3.1.6 |
Hi, I want to use my own classes but it throws me an type error.
Type: TypeError Message: Argument 1 passed to Posts::__construct() must be an instance of PostsRepository, none given, called in C:\wamp64\www\ciblog\system\core\CodeIgniter.php on line 518 Here is my code: Posts.php PHP Code: class Posts extends CI_controller PostsRepository.php PHP Code: <?php
AFAIK if you use the offical package of CI without extensions you cannot use namespaces with the main classes (controllers, models, libraries).
If you must use namespaced classes as controllers you have to redefine the loader or the CI base class. You can find a possible implementation here: https://github.com/kenjis/codeigniter3-n...controller |
Welcome Guest, Not a member yet? Register Sign In |