10
10
use Doctrine \ORM \Proxy \Autoloader ;
11
11
use Doctrine \Persistence \ManagerRegistry ;
12
12
use Illuminate \Contracts \Container \Container ;
13
- use Illuminate \Contracts \Validation \Factory as ValidationFactory ;
14
13
use Illuminate \Notifications \ChannelManager ;
15
14
use Illuminate \Support \ServiceProvider ;
16
- use Illuminate \Support \Str ;
17
15
use InvalidArgumentException ;
18
16
use LaravelDoctrine \ORM \Auth \DoctrineUserProvider ;
19
17
use LaravelDoctrine \ORM \Configuration \Cache \CacheManager ;
38
36
use function assert ;
39
37
use function class_exists ;
40
38
use function config_path ;
41
- use function property_exists ;
42
39
43
40
class DoctrineServiceProvider extends ServiceProvider
44
41
{
@@ -50,13 +47,9 @@ public function boot(): void
50
47
$ this ->extendAuthManager ();
51
48
$ this ->extendNotificationChannel ();
52
49
53
- if (! $ this ->isLumen ()) {
54
- $ this ->publishes ([
55
- $ this ->getConfigPath () => config_path ('doctrine.php ' ),
56
- ], 'config ' );
57
- }
58
-
59
- $ this ->ensureValidatorIsUsable ();
50
+ $ this ->publishes ([
51
+ $ this ->getConfigPath () => config_path ('doctrine.php ' ),
52
+ ], 'config ' );
60
53
}
61
54
62
55
/**
@@ -83,28 +76,6 @@ public function register(): void
83
76
$ this ->registerPresenceVerifierProvider ();
84
77
}
85
78
86
- protected function ensureValidatorIsUsable (): void
87
- {
88
- if (! $ this ->isLumen ()) {
89
- return ;
90
- }
91
-
92
- assert (property_exists ($ this ->app , 'availableBindings ' ));
93
-
94
- if ($ this ->shouldRegisterDoctrinePresenceValidator ()) {
95
- // due to weirdness the default presence verifier overrides one set by a service provider
96
- // so remove them so we can re add our implementation later
97
- unset($ this ->app ->availableBindings ['validator ' ]);
98
- unset($ this ->app ->availableBindings [ValidationFactory::class]);
99
- } else {
100
- // resolve the db,
101
- // this makes `isset($this->app['db']) == true`
102
- // which is required to set the presence verifier
103
- // in the default ValidationServiceProvider implementation
104
- $ this ->app ['db ' ];
105
- }
106
- }
107
-
108
79
/**
109
80
* Merge config
110
81
*/
@@ -114,14 +85,6 @@ protected function mergeConfig(): void
114
85
$ this ->getConfigPath (),
115
86
'doctrine ' ,
116
87
);
117
-
118
- if (! $ this ->isLumen ()) {
119
- return ;
120
- }
121
-
122
- $ this ->app ->configure ('cache ' );
123
- $ this ->app ->configure ('database ' );
124
- $ this ->app ->configure ('doctrine ' );
125
88
}
126
89
127
90
/**
@@ -232,15 +195,7 @@ protected function registerExtensions(): void
232
195
*/
233
196
protected function registerPresenceVerifierProvider (): void
234
197
{
235
- if ($ this ->isLumen ()) {
236
- $ this ->app ->singleton ('validator ' , function () {
237
- $ this ->app ->register (PresenceVerifierProvider::class);
238
-
239
- return $ this ->app ->make ('validator ' );
240
- });
241
- } else {
242
- $ this ->app ->register (PresenceVerifierProvider::class);
243
- }
198
+ $ this ->app ->register (PresenceVerifierProvider::class);
244
199
}
245
200
246
201
/**
@@ -279,7 +234,7 @@ protected function extendAuthManager(): void
279
234
280
235
/**
281
236
* Boots the extension manager at the appropriate time depending on if the app
282
- * is running as Laravel HTTP, Lumen HTTP or in a console environment
237
+ * is running as Laravel HTTP or in a console environment
283
238
*/
284
239
protected function bootExtensionManager (): void
285
240
{
@@ -354,11 +309,6 @@ protected function registerConsoleCommands(): void
354
309
]);
355
310
}
356
311
357
- protected function isLumen (): bool
358
- {
359
- return Str::contains ($ this ->app ->version (), 'Lumen ' );
360
- }
361
-
362
312
protected function shouldRegisterDoctrinePresenceValidator (): bool
363
313
{
364
314
return $ this ->app ['config ' ]->get ('doctrine.doctrine_presence_verifier ' , true );
0 commit comments