Container.php
113 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Infrastructure\Common; |
| 4 | |
| 5 | use AmeliaBooking\Domain\Repository\User\UserRepositoryInterface; |
| 6 | use AmeliaBooking\Infrastructure\Connection; |
| 7 | |
| 8 | /** |
| 9 | * Class Container |
| 10 | * |
| 11 | * @package AmeliaBooking\Infrastructure\Common |
| 12 | */ |
| 13 | final class Container extends \Slim\Container |
| 14 | { |
| 15 | /** |
| 16 | * @return Connection |
| 17 | * @throws \Interop\Container\Exception\ContainerException |
| 18 | */ |
| 19 | public function getDatabaseConnection() |
| 20 | { |
| 21 | return $this->get('app.connection'); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * @return UserRepositoryInterface |
| 26 | * @throws \Interop\Container\Exception\ContainerException |
| 27 | */ |
| 28 | public function getUserRepository() |
| 29 | { |
| 30 | return $this->get('domain.users.repository'); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Get the command bus |
| 35 | * |
| 36 | * @return mixed |
| 37 | * @throws \Interop\Container\Exception\ContainerException |
| 38 | */ |
| 39 | public function getCommandBus() |
| 40 | { |
| 41 | return $this->get('command.bus'); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Get the event bus |
| 46 | * |
| 47 | * @return mixed |
| 48 | * @throws \Interop\Container\Exception\ContainerException |
| 49 | */ |
| 50 | public function getEventBus() |
| 51 | { |
| 52 | return $this->get('domain.event.bus'); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Get the Permissions domain service |
| 57 | * |
| 58 | * @throws \Interop\Container\Exception\ContainerException |
| 59 | */ |
| 60 | public function getPermissionsService() |
| 61 | { |
| 62 | return $this->get('domain.permissions.service'); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Get the API Permissions domain service |
| 67 | * |
| 68 | * @throws \Interop\Container\Exception\ContainerException |
| 69 | */ |
| 70 | public function getApiPermissionsService() |
| 71 | { |
| 72 | return $this->get('domain.api.permissions.service'); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Get the API User application service |
| 77 | * |
| 78 | * @throws \Interop\Container\Exception\ContainerException |
| 79 | */ |
| 80 | public function getApiUserApplicationService() |
| 81 | { |
| 82 | return $this->get('application.api.user.service'); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Get the User application service |
| 87 | * |
| 88 | * @throws \Interop\Container\Exception\ContainerException |
| 89 | */ |
| 90 | public function getUserApplicationService() |
| 91 | { |
| 92 | return $this->get('application.user.service'); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * @return mixed |
| 97 | * @throws \Interop\Container\Exception\ContainerException |
| 98 | */ |
| 99 | public function getMailerService() |
| 100 | { |
| 101 | return $this->get('application.mailer'); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * @return mixed |
| 106 | * @throws \Interop\Container\Exception\ContainerException |
| 107 | */ |
| 108 | public function getSettingsService() |
| 109 | { |
| 110 | return $this->get('domain.settings.service'); |
| 111 | } |
| 112 | } |
| 113 |