diff --git a/src/Service/Container.php b/src/Service/Container.php index 9ecb3de..afecf12 100644 --- a/src/Service/Container.php +++ b/src/Service/Container.php @@ -13,6 +13,7 @@ use App\Controller\AddressBookAdminController; use App\Controller\AddressBookController; use App\Controller\SecurityController; use App\Entity\User; +use App\Repository\AddressRepository; use App\Repository\UserRepository; /* @@ -26,6 +27,7 @@ class Container private AddressBookController $addressBook; private AddressBookAdminController $addressBookAdmin; + private AddressRepository $addressRepository; private Config $config; private DatabaseConnection $databaseConnection; private Router $router; @@ -41,13 +43,14 @@ class Container $this->template = new Template(templateDir: dirname(path: __DIR__, levels: 2) . '/templates/'); $this->router = new Router(template: $this->template); $this->userRepository = new UserRepository(databaseConnection: $this->databaseConnection); + $this->addressRepository = new AddressRepository(databaseConnection: $this->databaseConnection); $this->securityController = new SecurityController(template: $this->template, userRepository: $this->userRepository, router: $this->router); if (empty($_SESSION['user_id'])) { $this->user = new User(); // ANONYMOUS } else { $this->user = $this->userRepository->findByID(id: $_SESSION['user_id']); } - $this->addressBook = new AddressBookController(template: $this->template, user: $this->user, userRepository: $this->userRepository, router: $this->router); + $this->addressBook = new AddressBookController(template: $this->template, user: $this->user, addressRepository: $this->addressRepository, router: $this->router); $this->addressBookAdmin = new AddressBookAdminController(template: $this->template, user: $this->user, userRepository: $this->userRepository, router: $this->router); }