diff --git a/app/Backoffice/Users/Application/Event/Register/UsersListeners.php b/app/Backoffice/Users/Application/Event/Register/UsersListeners.php index e36d9d9..b3f8058 100644 --- a/app/Backoffice/Users/Application/Event/Register/UsersListeners.php +++ b/app/Backoffice/Users/Application/Event/Register/UsersListeners.php @@ -13,7 +13,7 @@ class UsersListeners extends ListenersRegister public function register(): void { $this->emitter->addListener( - "users.created", + "backoffice.users.created", function (UserCreated $userCreated) { (new UserCreatedListener($this->container))->handle($userCreated); } diff --git a/app/Backoffice/Users/Domain/Event/UserCreated.php b/app/Backoffice/Users/Domain/Event/UserCreated.php index 4005149..c4373eb 100644 --- a/app/Backoffice/Users/Domain/Event/UserCreated.php +++ b/app/Backoffice/Users/Domain/Event/UserCreated.php @@ -17,7 +17,7 @@ public function __construct(string $email) public function getName() { - return 'users.created'; + return 'backoffice.users.created'; } public function email(): string diff --git a/app/Backoffice/Users/UI/Http/Auth/OAuth2UserCredentials.php b/app/Backoffice/Users/UI/Http/Auth/OAuth2UserCredentials.php index 8bca1e6..58d3b78 100644 --- a/app/Backoffice/Users/UI/Http/Auth/OAuth2UserCredentials.php +++ b/app/Backoffice/Users/UI/Http/Auth/OAuth2UserCredentials.php @@ -20,7 +20,7 @@ public function checkUserCredentials($username, $password) $queryBuilder ->select('u.password') - ->from('user', 'u') + ->from('backoffice_user', 'u') ->where('u.email = :email') ->setParameter('email', $username); @@ -39,7 +39,7 @@ public function getUserDetails($username) $queryBuilder ->select('ouuid_to_uuid(u.id_user) as id_user') - ->from('user', 'u') + ->from('backoffice_user', 'u') ->where('u.email = :email') ->setParameter('email', $username); diff --git a/bootstrap/definitions.php b/bootstrap/definitions.php index 82e254a..3ff8739 100644 --- a/bootstrap/definitions.php +++ b/bootstrap/definitions.php @@ -17,15 +17,15 @@ use Cordo\Core\Infractructure\Mailer\ZendMail\MailerInterface; return [ - 'config' => DI\factory(static function () { + 'config' => DI\factory(static function () { return new Config(config_path(), new Parser()); }), - 'lang' => DI\factory(static function () { + 'lang' => DI\factory(static function () { return new Config(resources_path() . 'lang', new Parser()); }), - 'request' => DI\get(ServerRequestInterface::class), - 'router' => DI\get(Router::class), - 'emitter' => DI\get(EmitterInterface::class), + 'request' => DI\get(ServerRequestInterface::class), + 'router' => DI\get(Router::class), + 'emitter' => DI\get(EmitterInterface::class), ServerRequestInterface::class => DI\factory('GuzzleHttp\Psr7\ServerRequest::fromGlobals'), ErrorReporterInterface::class => DI\get('error_reporter'), MailerInterface::class => DI\get('mailer'), @@ -37,4 +37,5 @@ }), Engine::class => DI\get('templates'), Translator::class => DI\get('translator'), + Config::class => DI\get('config'), ]; diff --git a/helpers/helper_functions.php b/helpers/helper_functions.php index 772d904..8f96022 100644 --- a/helpers/helper_functions.php +++ b/helpers/helper_functions.php @@ -2,6 +2,10 @@ function env(string $index): string { + if (!array_key_exists($index, $_ENV)) { + throw new OutOfBoundsException("{$index} is not a valid key for .env variables."); + } + return $_ENV[$index]; }