Skip to content

Commit 76ded4f

Browse files
authored
Merge pull request #545 from akomm/0.11
fix #543
2 parents e5d7346 + 1c93921 commit 76ded4f

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

src/Config/Processor/InheritanceProcessor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ private static function inheritsTypeConfig($child, array $parents, array $config
8888
unset($mergedParentsConfig['resolveType']);
8989
}
9090

91+
if (isset($mergedParentsConfig['interfaces'], $childType['config']['interfaces'])) {
92+
$childType['config']['interfaces'] = \array_merge($mergedParentsConfig['interfaces'], $childType['config']['interfaces']);
93+
}
94+
9195
$configs = \array_replace_recursive(['config' => $mergedParentsConfig], $childType);
9296

9397
return $configs;

tests/Functional/App/config/inheritance/mapping/Decorators.types.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,38 @@ QueryFooDecorator:
1313
fields:
1414
period:
1515
type: Period
16+
17+
InterfaceA:
18+
type: interface
19+
config:
20+
fields:
21+
a:
22+
type: String
23+
24+
InterfaceB:
25+
type: interface
26+
config:
27+
fields:
28+
b:
29+
type: String
30+
31+
DecoratorA:
32+
type: object
33+
decorator: true
34+
config:
35+
interfaces:
36+
- InterfaceA
37+
fields:
38+
a:
39+
type: String
40+
41+
AandB:
42+
type: object
43+
inherits:
44+
- DecoratorA
45+
config:
46+
interfaces:
47+
- InterfaceB
48+
fields:
49+
b:
50+
type: String

tests/Functional/Inheritance/InheritanceTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,32 @@ public function testDecoratorTypeShouldRemovedFromFinalConfig()
7878
$this->assertArrayNotHasKey('QueryBarDecorator', $this->config);
7979
$this->assertArrayNotHasKey('QueryFooDecorator', $this->config);
8080
}
81+
82+
public function testDecoratorInterfacesShouldMerge()
83+
{
84+
$this->assertArrayHasKey('AandB', $this->config);
85+
$this->assertSame(
86+
[
87+
'type' => 'object',
88+
InheritanceProcessor::INHERITS_KEY => ['DecoratorA'],
89+
'class_name' => 'AandBType',
90+
'decorator' => false,
91+
'config' => [
92+
'interfaces' => ['InterfaceA', 'InterfaceB'],
93+
'fields' => [
94+
'a' => [
95+
'type' => 'String',
96+
'args' => [],
97+
],
98+
'b' => [
99+
'type' => 'String',
100+
'args' => [],
101+
],
102+
],
103+
'name' => 'AandB',
104+
],
105+
],
106+
$this->config['AandB']
107+
);
108+
}
81109
}

0 commit comments

Comments
 (0)