@@ -23,9 +23,15 @@ class Bookmark extends AbstractExtensibleModel implements BookmarkInterface
23
23
{
24
24
/**
25
25
* @var DecoderInterface
26
+ * @deprecated
26
27
*/
27
28
protected $ jsonDecoder ;
28
29
30
+ /**
31
+ * @var \Magento\Framework\Serialize\Serializer\Json
32
+ */
33
+ private $ serializer ;
34
+
29
35
/**
30
36
* @param Context $context
31
37
* @param Registry $registry
@@ -35,6 +41,8 @@ class Bookmark extends AbstractExtensibleModel implements BookmarkInterface
35
41
* @param Collection $resourceCollection
36
42
* @param DecoderInterface $jsonDecoder
37
43
* @param array $data
44
+ * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
45
+ * @throws \RuntimeException
38
46
*/
39
47
public function __construct (
40
48
Context $ context ,
@@ -44,9 +52,12 @@ public function __construct(
44
52
ResourceBookmark $ resource ,
45
53
Collection $ resourceCollection ,
46
54
DecoderInterface $ jsonDecoder ,
47
- array $ data = []
55
+ array $ data = [],
56
+ \Magento \Framework \Serialize \Serializer \Json $ serializer = null
48
57
) {
49
58
$ this ->jsonDecoder = $ jsonDecoder ;
59
+ $ this ->serializer = $ serializer ?: \Magento \Framework \App \ObjectManager::getInstance ()
60
+ ->get (\Magento \Framework \Serialize \Serializer \Json::class);
50
61
parent ::__construct (
51
62
$ context ,
52
63
$ registry ,
@@ -127,7 +138,7 @@ public function getConfig()
127
138
{
128
139
$ config = $ this ->getData (self ::CONFIG );
129
140
if ($ config ) {
130
- return $ this ->jsonDecoder -> decode ($ config );
141
+ return $ this ->serializer -> unserialize ($ config );
131
142
}
132
143
return [];
133
144
}
0 commit comments