Skip to content

Commit 6b4a839

Browse files
committed
Rework of ConfigMerger: you should add ConfigMerger::Strict => false inside unprotected array instead of $strict and $unprotected properties. Also added ConfigMerger::Replace that will replace array completely instead of merge.
1 parent 97109d9 commit 6b4a839

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

config/config.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?php declare(strict_types = 1);
22

3+
use LastDragon_ru\LaraASP\Core\Utils\ConfigMerger;
4+
35
/**
46
* -----------------------------------------------------------------------------
57
* GraphQL Settings
68
* -----------------------------------------------------------------------------
79
*/
8-
910
return [
1011
/**
1112
* Settings for @searchBy directive.
@@ -20,7 +21,8 @@
2021
* @var array<string, array<class-string<\LastDragon_ru\LaraASP\GraphQL\SearchBy\Contracts\Operator>>>
2122
*/
2223
'scalars' => [
23-
// empty
24+
// This value has no effect inside the published config.
25+
ConfigMerger::Strict => false,
2426
],
2527

2628
/**
@@ -32,7 +34,8 @@
3234
* @var array<string, string>
3335
*/
3436
'aliases' => [
35-
// empty
37+
// This value has no effect inside the published config.
38+
ConfigMerger::Strict => false,
3639
],
3740
],
3841

@@ -44,6 +47,7 @@
4447
* @see \LastDragon_ru\LaraASP\Eloquent\Enum
4548
*/
4649
'enums' => [
47-
// empty
50+
// This value has no effect inside the published config.
51+
ConfigMerger::Strict => false,
4852
],
4953
];

src/Provider.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ class Provider extends ServiceProvider {
2323
use ProviderWithTranslations;
2424

2525
public function boot(Dispatcher $dispatcher): void {
26-
$this->bootConfig([
27-
'search_by.scalars',
28-
'search_by.aliases',
29-
'enums',
30-
]);
26+
$this->bootConfig();
3127
$this->bootDirectives($dispatcher);
3228
}
3329

@@ -74,7 +70,9 @@ protected function registerEnums(): void {
7470
$name = null;
7571
}
7672

77-
$registry->register(EnumHelper::getType($enum, $name));
73+
if ($enum) {
74+
$registry->register(EnumHelper::getType($enum, $name));
75+
}
7876
}
7977
}
8078

0 commit comments

Comments
 (0)