ArgumentCountError Too few arguments to function ::__construct() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: ArgumentCountError Too few arguments to function ::__construct() (/showthread.php?tid=87661) |
ArgumentCountError Too few arguments to function ::__construct() - destor77 - 05-15-2023 I am trying to implement hexagonal architecture in CI4, I want to make a method to save in the database which actions were executed, for this I am doing the following: app/PunkCore/Shared/Interfaces/Repository/UserActivityRepositoryInterface.php PHP Code: <?php app/PunkCore/Shared/Infrastructure/Repository/UserActivityRepository.php PHP Code: <?php PHP Code: <?php PHP Code: <?php ArgumentCountError Too few arguments to function App\Controllers\Admin\AdminController::__construct(), 0 passed in /mnt/d/html/punkframework/system/CodeIgniter.php on line 906 and exactly 4 expected ArgumentCou ArgumentCountError Too few arguments to function App\Controllers\Admin\AdminController::__construct(), 0 passed in /mnt/d/html/punkframework/system/CodeIgniter.php on line 906 and exactly 4 expected APPPATH/Controllers/Admin/AdminController.php at line 42 Code: 35 $this->response = $response;
PHP Code: <?php and I don't know where I am failing. RE: ArgumentCountError Too few arguments to function ::__construct() - kenjis - 05-19-2023 The controller in CI4 does not have the __construct() method. See https://github.com/codeigniter4/CodeIgniter4/blob/develop/system/Controller.php So if you add __construct(), no parameters are passed by the framework. RE: ArgumentCountError Too few arguments to function ::__construct() - destor77 - 05-20-2023 thanks! |