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
PostsRepository.php
How can I solve this problem? Thank you!!!
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
{
public function __construct (\application\repositories\posts\PostsRepository $postsRepository) {
$this->postsRepository = $postsRepository;
}
......
PostsRepository.php
PHP Code:
<?php
class PostsRepository() {
public function all(){
return \application\models\Post_model->get_posts();
}
}