17
17
use Magento \Framework \View \Element \UiComponent \Config \Provider \Component \Definition as ComponentDefinition ;
18
18
use Magento \Framework \View \Element \UiComponent \Config \ReaderFactory ;
19
19
use Magento \Framework \View \Element \UiComponent \Config \UiReaderInterface ;
20
+ use Magento \Framework \Serialize \SerializerInterface ;
21
+ use Magento \Framework \App \ObjectManager ;
20
22
21
23
/**
22
24
* Class Manager
@@ -94,6 +96,11 @@ class Manager implements ManagerInterface
94
96
*/
95
97
protected $ uiReader ;
96
98
99
+ /**
100
+ * @var SerializerInterface
101
+ */
102
+ private $ serializer ;
103
+
97
104
/**
98
105
* @param ComponentDefinition $componentConfigProvider
99
106
* @param DomMergerInterface $domMerger
@@ -102,6 +109,7 @@ class Manager implements ManagerInterface
102
109
* @param AggregatedFileCollectorFactory $aggregatedFileCollectorFactory
103
110
* @param CacheInterface $cache
104
111
* @param InterpreterInterface $argumentInterpreter
112
+ * @param SerializerInterface|null $serializer
105
113
*/
106
114
public function __construct (
107
115
ComponentDefinition $ componentConfigProvider ,
@@ -110,7 +118,8 @@ public function __construct(
110
118
ArrayObjectFactory $ arrayObjectFactory ,
111
119
AggregatedFileCollectorFactory $ aggregatedFileCollectorFactory ,
112
120
CacheInterface $ cache ,
113
- InterpreterInterface $ argumentInterpreter
121
+ InterpreterInterface $ argumentInterpreter ,
122
+ SerializerInterface $ serializer = null
114
123
) {
115
124
$ this ->componentConfigProvider = $ componentConfigProvider ;
116
125
$ this ->domMerger = $ domMerger ;
@@ -120,6 +129,7 @@ public function __construct(
120
129
$ this ->aggregatedFileCollectorFactory = $ aggregatedFileCollectorFactory ;
121
130
$ this ->cache = $ cache ;
122
131
$ this ->argumentInterpreter = $ argumentInterpreter ;
132
+ $ this ->serializer = $ serializer ?: ObjectManager::getInstance ()->get (SerializerInterface::class);
123
133
}
124
134
125
135
/**
@@ -164,9 +174,14 @@ public function prepareData($name)
164
174
$ cachedPool = $ this ->cache ->load ($ cacheID );
165
175
if ($ cachedPool === false ) {
166
176
$ this ->prepare ($ name );
167
- $ this ->cache ->save ($ this ->componentsPool ->serialize (), $ cacheID );
177
+ $ this ->cache ->save (
178
+ $ this ->serializer ->serialize ($ this ->componentsPool ->getArrayCopy ()),
179
+ $ cacheID
180
+ );
168
181
} else {
169
- $ this ->componentsPool ->unserialize ($ cachedPool );
182
+ $ this ->componentsPool ->exchangeArray (
183
+ $ this ->serializer ->unserialize ($ cachedPool )
184
+ );
170
185
}
171
186
$ this ->componentsData ->offsetSet ($ name , $ this ->componentsPool );
172
187
$ this ->componentsData ->offsetSet ($ name , $ this ->evaluateComponentArguments ($ this ->getData ($ name )));
0 commit comments