Skip to content
Snippets Groups Projects
Commit 982bed00 authored by Igor Melnikov's avatar Igor Melnikov
Browse files

MAGETWO-60442: Add optional SerializerInterface dependency to child classes of...

MAGETWO-60442: Add optional SerializerInterface dependency to child classes of \Magento\Framework\Config\Data

Adding SerializerInterface dependency in the constructor
parent 2891de98
Branches
No related merge requests found
......@@ -92,7 +92,8 @@ class PluginList extends Scoped implements InterceptionPluginList
* @param ObjectManagerInterface $objectManager
* @param ClassDefinitions $classDefinitions
* @param array $scopePriorityScheme
* @param string $cacheId
* @param string|null $cacheId
* @param SerializerInterface|null $serializer
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
......@@ -105,9 +106,11 @@ class PluginList extends Scoped implements InterceptionPluginList
ObjectManagerInterface $objectManager,
ClassDefinitions $classDefinitions,
array $scopePriorityScheme = ['global'],
$cacheId = 'plugins'
$cacheId = 'plugins',
SerializerInterface $serializer = null
) {
parent::__construct($reader, $configScope, $cache, $cacheId);
$serializer = $serializer ?: $objectManager->get(Serialize::class);
parent::__construct($reader, $configScope, $cache, $cacheId, $serializer);
$this->_omConfig = $omConfig;
$this->_relations = $relations;
$this->_definitions = $definitions;
......@@ -277,7 +280,7 @@ class PluginList extends Scoped implements InterceptionPluginList
$cacheId = implode('|', $this->_scopePriorityScheme) . "|" . $this->_cacheId;
$data = $this->_cache->load($cacheId);
if ($data) {
list($this->_data, $this->_inherited, $this->_processed) = $this->getSerializer()->unserialize($data);
list($this->_data, $this->_inherited, $this->_processed) = $this->serializer->unserialize($data);
foreach ($this->_scopePriorityScheme as $scope) {
$this->_loadedScopes[$scope] = true;
}
......@@ -311,7 +314,7 @@ class PluginList extends Scoped implements InterceptionPluginList
$this->_inheritPlugins($class);
}
$this->_cache->save(
$this->getSerializer()->serialize([$this->_data, $this->_inherited, $this->_processed]),
$this->serializer->serialize([$this->_data, $this->_inherited, $this->_processed]),
$cacheId
);
}
......@@ -389,18 +392,4 @@ class PluginList extends Scoped implements InterceptionPluginList
}
return $this->logger;
}
/**
* Get serializer
*
* @return SerializerInterface
* @deprecated
*/
protected function getSerializer()
{
if (null === $this->serializer) {
$this->serializer = \Magento\Framework\App\ObjectManager::getInstance()->get(Serialize::class);
}
return $this->serializer;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment