Skip to content

Commit f254304

Browse files
committed
move event listener to application
1 parent b37d9af commit f254304

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

config/bootstrap.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@
3232
*/
3333
require CORE_PATH . 'config' . DS . 'bootstrap.php';
3434

35-
use App\Event\AfterGithubIdentify;
3635
use Cake\Cache\Cache;
3736
use Cake\Core\Configure;
3837
use Cake\Core\Configure\Engine\PhpConfig;
3938
use Cake\Datasource\ConnectionManager;
4039
use Cake\Error\ErrorTrap;
4140
use Cake\Error\ExceptionTrap;
42-
use Cake\Event\EventManager;
4341
use Cake\Http\ServerRequest;
4442
use Cake\Log\Log;
4543
use Cake\Mailer\Mailer;
@@ -207,8 +205,6 @@
207205
return $detector->isTablet();
208206
});
209207

210-
EventManager::instance()->on(new AfterGithubIdentify());
211-
212208
/*
213209
* You can enable default locale format parsing by adding calls
214210
* to `useLocaleParser()`. This enables the automatic conversion of

src/Application.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
namespace App;
1818

1919
use ADmad\SocialAuth\Middleware\SocialAuthMiddleware;
20+
use App\Event\AfterGithubIdentify;
2021
use Authentication\AuthenticationService;
2122
use Authentication\AuthenticationServiceInterface;
2223
use Authentication\AuthenticationServiceProviderInterface;
@@ -25,6 +26,7 @@
2526
use Cake\Core\ContainerInterface;
2627
use Cake\Datasource\FactoryLocator;
2728
use Cake\Error\Middleware\ErrorHandlerMiddleware;
29+
use Cake\Event\EventManager;
2830
use Cake\Http\BaseApplication;
2931
use Cake\Http\Middleware\BodyParserMiddleware;
3032
use Cake\Http\Middleware\CsrfProtectionMiddleware;
@@ -62,6 +64,8 @@ public function bootstrap(): void
6264
(new TableLocator())->allowFallbackClass(false),
6365
);
6466
}
67+
68+
EventManager::instance()->on(new AfterGithubIdentify());
6569
}
6670

6771
/**

0 commit comments

Comments
 (0)