added AddressBookController
This commit is contained in:
parent
3bf0c2b44f
commit
a973a4362f
|
@ -13,6 +13,7 @@ use App\Controller\AddressBookAdminController;
|
||||||
use App\Controller\AddressBookController;
|
use App\Controller\AddressBookController;
|
||||||
use App\Controller\SecurityController;
|
use App\Controller\SecurityController;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
|
use App\Repository\AddressRepository;
|
||||||
use App\Repository\UserRepository;
|
use App\Repository\UserRepository;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -26,6 +27,7 @@ class Container
|
||||||
|
|
||||||
private AddressBookController $addressBook;
|
private AddressBookController $addressBook;
|
||||||
private AddressBookAdminController $addressBookAdmin;
|
private AddressBookAdminController $addressBookAdmin;
|
||||||
|
private AddressRepository $addressRepository;
|
||||||
private Config $config;
|
private Config $config;
|
||||||
private DatabaseConnection $databaseConnection;
|
private DatabaseConnection $databaseConnection;
|
||||||
private Router $router;
|
private Router $router;
|
||||||
|
@ -41,13 +43,14 @@ class Container
|
||||||
$this->template = new Template(templateDir: dirname(path: __DIR__, levels: 2) . '/templates/');
|
$this->template = new Template(templateDir: dirname(path: __DIR__, levels: 2) . '/templates/');
|
||||||
$this->router = new Router(template: $this->template);
|
$this->router = new Router(template: $this->template);
|
||||||
$this->userRepository = new UserRepository(databaseConnection: $this->databaseConnection);
|
$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);
|
$this->securityController = new SecurityController(template: $this->template, userRepository: $this->userRepository, router: $this->router);
|
||||||
if (empty($_SESSION['user_id'])) {
|
if (empty($_SESSION['user_id'])) {
|
||||||
$this->user = new User(); // ANONYMOUS
|
$this->user = new User(); // ANONYMOUS
|
||||||
} else {
|
} else {
|
||||||
$this->user = $this->userRepository->findByID(id: $_SESSION['user_id']);
|
$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);
|
$this->addressBookAdmin = new AddressBookAdminController(template: $this->template, user: $this->user, userRepository: $this->userRepository, router: $this->router);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue