@@ -53,9 +53,15 @@ class Save extends AbstractAction
53
53
54
54
/**
55
55
* @var DecoderInterface
56
+ * @deprecated
56
57
*/
57
58
protected $ jsonDecoder ;
58
59
60
+ /**
61
+ * @var \Magento\Framework\Serialize\Serializer\Json
62
+ */
63
+ private $ serializer ;
64
+
59
65
/**
60
66
* @param Context $context
61
67
* @param UiComponentFactory $factory
@@ -72,20 +78,25 @@ public function __construct(
72
78
BookmarkManagementInterface $ bookmarkManagement ,
73
79
BookmarkInterfaceFactory $ bookmarkFactory ,
74
80
UserContextInterface $ userContext ,
75
- DecoderInterface $ jsonDecoder
81
+ DecoderInterface $ jsonDecoder ,
82
+ \Magento \Framework \Serialize \Serializer \Json $ serializer = null
76
83
) {
77
84
parent ::__construct ($ context , $ factory );
78
85
$ this ->bookmarkRepository = $ bookmarkRepository ;
79
86
$ this ->bookmarkManagement = $ bookmarkManagement ;
80
87
$ this ->bookmarkFactory = $ bookmarkFactory ;
81
88
$ this ->userContext = $ userContext ;
82
89
$ this ->jsonDecoder = $ jsonDecoder ;
90
+ $ this ->serializer = $ serializer ?: \Magento \Framework \App \ObjectManager::getInstance ()
91
+ ->get (\Magento \Framework \Serialize \Serializer \Json::class);
83
92
}
84
93
85
94
/**
86
95
* Action for AJAX request
87
96
*
88
97
* @return void
98
+ * @throws \InvalidArgumentException
99
+ * @throws \LogicException
89
100
*/
90
101
public function execute ()
91
102
{
@@ -94,7 +105,7 @@ public function execute()
94
105
if (!$ jsonData ) {
95
106
throw new \InvalidArgumentException ('Invalid parameter "data" ' );
96
107
}
97
- $ data = $ this ->jsonDecoder -> decode ($ jsonData );
108
+ $ data = $ this ->serializer -> unserialize ($ jsonData );
98
109
$ action = key ($ data );
99
110
switch ($ action ) {
100
111
case self ::ACTIVE_IDENTIFIER :
0 commit comments