Skip to content

Commit

Permalink
various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariusz Korsak committed Mar 24, 2020
1 parent 57deb6e commit 0097028
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Backoffice/Users/Domain/Event/UserCreated.php
Expand Up @@ -17,7 +17,7 @@ public function __construct(string $email)

public function getName()
{
return 'users.created';
return 'backoffice.users.created';
}

public function email(): string
Expand Down
4 changes: 2 additions & 2 deletions app/Backoffice/Users/UI/Http/Auth/OAuth2UserCredentials.php
Expand Up @@ -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);

Expand All @@ -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);

Expand Down
11 changes: 6 additions & 5 deletions bootstrap/definitions.php
Expand Up @@ -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'),
Expand All @@ -37,4 +37,5 @@
}),
Engine::class => DI\get('templates'),
Translator::class => DI\get('translator'),
Config::class => DI\get('config'),
];
4 changes: 4 additions & 0 deletions helpers/helper_functions.php
Expand Up @@ -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];
}

Expand Down

0 comments on commit 0097028

Please sign in to comment.