Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using virtual type to configure plugin, interceptor method cannot be … #33981

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Magento\Framework\Interception\Config\Config as InterceptionConfig;
use Magento\Setup\Module\Di\Code\Reader\Type;
use Magento\Framework\ObjectManager\InterceptableValidator;
use Magento\Framework\Interception\ObjectManager\ConfigInterface;

class InterceptionConfigurationBuilder
{
Expand Down Expand Up @@ -49,24 +50,32 @@ class InterceptionConfigurationBuilder
private $interceptableValidator;

/**
* @param InterceptionConfig $interceptionConfig
* @param PluginList $pluginList
* @param Type $typeReader
* @param Manager $cacheManager
* @var ConfigInterface
*/
private $omConfig;

/**
* @param InterceptionConfig $interceptionConfig
* @param PluginList $pluginList
* @param Type $typeReader
* @param Manager $cacheManager
* @param InterceptableValidator $interceptableValidator
* @param ConfigInterface $omConfig
*/
public function __construct(
InterceptionConfig $interceptionConfig,
PluginList $pluginList,
Type $typeReader,
Manager $cacheManager,
InterceptableValidator $interceptableValidator
InterceptableValidator $interceptableValidator,
ConfigInterface $omConfig
) {
$this->interceptionConfig = $interceptionConfig;
$this->pluginList = $pluginList;
$this->typeReader = $typeReader;
$this->cacheManager = $cacheManager;
$this->interceptableValidator = $interceptableValidator;
$this->omConfig = $omConfig;
}

/**
Expand Down Expand Up @@ -201,6 +210,11 @@ private function getInterceptedMethods($interceptionConfiguration)
foreach ($interceptionConfiguration as &$plugins) {
$pluginsMethods = [];
foreach ($plugins as $plugin) {
$realPlugin = $this->omConfig->getOriginalInstanceType($plugin);
if ($realPlugin != $plugin) {
$plugin = $realPlugin;
}
GrassH marked this conversation as resolved.
Show resolved Hide resolved

$pluginsMethods = array_unique(
array_merge($pluginsMethods, array_keys($pluginDefinitionList->getMethodList($plugin)))
);
Expand Down