@@ -132,19 +132,27 @@ class Migration
132
132
*/
133
133
private $ setup ;
134
134
135
+ /**
136
+ * @var \Magento\Framework\Serialize\Serializer\Json
137
+ */
138
+ private $ serializer ;
139
+
135
140
/**
136
141
* @param ModuleDataSetupInterface $setup
137
142
* @param Filesystem $filesystem
138
143
* @param MigrationData $migrationData
139
144
* @param string $confPathToMapFile
140
145
* @param array $compositeModules
146
+ * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
147
+ * @throws \RuntimeException
141
148
*/
142
149
public function __construct (
143
150
ModuleDataSetupInterface $ setup ,
144
151
Filesystem $ filesystem ,
145
152
MigrationData $ migrationData ,
146
153
$ confPathToMapFile ,
147
- $ compositeModules = []
154
+ $ compositeModules = [],
155
+ \Magento \Framework \Serialize \Serializer \Json $ serializer = null
148
156
) {
149
157
$ this ->_directory = $ filesystem ->getDirectoryRead (DirectoryList::ROOT );
150
158
$ this ->_pathToMapFile = $ confPathToMapFile ;
@@ -155,6 +163,8 @@ public function __construct(
155
163
];
156
164
$ this ->_compositeModules = $ compositeModules ;
157
165
$ this ->setup = $ setup ;
166
+ $ this ->serializer = $ serializer ?: \Magento \Framework \App \ObjectManager::getInstance ()
167
+ ->get (\Magento \Framework \Serialize \Serializer \Json::class);
158
168
}
159
169
160
170
/**
@@ -694,10 +704,27 @@ public function getCompositeModules()
694
704
*
695
705
* @param string $encodedValue
696
706
* @param int $objectDecodeType
697
- * @return mixed
707
+ * @return string|int|float|bool|array|null
708
+ * @throws \InvalidArgumentException
709
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
710
+ * @deprecated
711
+ * @see \Magento\Framework\Module\Setup\Migration::jsonDecode
712
+ */
713
+ protected function _jsonDecode ($ encodedValue , $ objectDecodeType = 1 )
714
+ {
715
+ return $ this ->jsonDecode ($ encodedValue );
716
+ }
717
+
718
+ /**
719
+ * Decodes the given $encodedValue string which is
720
+ * encoded in the JSON format
721
+ *
722
+ * @param string $encodedValue
723
+ * @return string|int|float|bool|array|null
724
+ * @throws \InvalidArgumentException
698
725
*/
699
- protected function _jsonDecode ($ encodedValue, $ objectDecodeType = \Zend_Json:: TYPE_ARRAY )
726
+ private function jsonDecode ($ encodedValue )
700
727
{
701
- return \Zend_Json:: decode ($ encodedValue, $ objectDecodeType );
728
+ return $ this -> serializer -> unserialize ($ encodedValue );
702
729
}
703
730
}
0 commit comments