Skip to content

Commit 3d49cf2

Browse files
committed
fix: Allow for one ComponentContext to inherit from multiple others
1 parent b14d086 commit 3d49cf2

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Component/AbstractComponentContext.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
use Magento\Framework\Exception\LocalizedException;
77
use Magento\Framework\Phrase;
8+
use Throwable;
89

910
class AbstractComponentContext implements ComponentContextInterface
1011
{
@@ -27,6 +28,15 @@ public function __call(string $methodName, array $arguments)
2728
return $parentContext->{$methodName}(...$arguments);
2829
}
2930

31+
if (isset($this->dependencies['parentContexts'])) {
32+
foreach ($this->dependencies['parentContexts'] as $parentContext) {
33+
try {
34+
return $parentContext->{$methodName}(...$arguments);
35+
} catch (Throwable $e) {
36+
}
37+
}
38+
}
39+
3040
throw new LocalizedException(
3141
new Phrase(
3242
'Invalid method %1::%2. No object "%3": %4',

0 commit comments

Comments
 (0)