File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
lib/internal/Magento/Framework/Controller/Result Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,22 @@ class Json extends AbstractResult
29
29
protected $ json ;
30
30
31
31
/**
32
- * @param \Magento\Framework\Translate\InlineInterface $translateInline
32
+ * @var \Magento\Framework\Serialize\Serializer\Json
33
33
*/
34
- public function __construct (InlineInterface $ translateInline )
35
- {
34
+ private $ serializer ;
35
+
36
+ /**
37
+ * @param InlineInterface $translateInline
38
+ * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
39
+ * @throws \RuntimeException
40
+ */
41
+ public function __construct (
42
+ InlineInterface $ translateInline ,
43
+ \Magento \Framework \Serialize \Serializer \Json $ serializer = null
44
+ ) {
36
45
$ this ->translateInline = $ translateInline ;
46
+ $ this ->serializer = $ serializer ?: \Magento \Framework \App \ObjectManager::getInstance ()
47
+ ->get (\Magento \Framework \Serialize \Serializer \Json::class);
37
48
}
38
49
39
50
/**
@@ -43,10 +54,11 @@ public function __construct(InlineInterface $translateInline)
43
54
* @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default
44
55
* @param array $options Additional options used during encoding
45
56
* @return $this
57
+ * @throws \InvalidArgumentException
46
58
*/
47
59
public function setData ($ data , $ cycleCheck = false , $ options = [])
48
60
{
49
- $ this ->json = \Zend_Json:: encode ($ data, $ cycleCheck , $ options );
61
+ $ this ->json = $ this -> serializer -> serialize ($ data );
50
62
return $ this ;
51
63
}
52
64
You can’t perform that action at this time.
0 commit comments