Skip to content

Commit e9fa41e

Browse files
committed
Replace the usage of Magento\Framework\Json\DecoderInterface in the Bookmark model,
- deprecate the $jsonDecoder, - inject the new \Magento\Framework\Serialize\Serializer\Json - replace the usage of $jsonDecoder with the $serializer
1 parent 0548157 commit e9fa41e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

app/code/Magento/Ui/Model/Bookmark.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ class Bookmark extends AbstractExtensibleModel implements BookmarkInterface
2323
{
2424
/**
2525
* @var DecoderInterface
26+
* @deprecated
2627
*/
2728
protected $jsonDecoder;
2829

30+
/**
31+
* @var \Magento\Framework\Serialize\Serializer\Json
32+
*/
33+
private $serializer;
34+
2935
/**
3036
* @param Context $context
3137
* @param Registry $registry
@@ -35,6 +41,8 @@ class Bookmark extends AbstractExtensibleModel implements BookmarkInterface
3541
* @param Collection $resourceCollection
3642
* @param DecoderInterface $jsonDecoder
3743
* @param array $data
44+
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
45+
* @throws \RuntimeException
3846
*/
3947
public function __construct(
4048
Context $context,
@@ -44,9 +52,12 @@ public function __construct(
4452
ResourceBookmark $resource,
4553
Collection $resourceCollection,
4654
DecoderInterface $jsonDecoder,
47-
array $data = []
55+
array $data = [],
56+
\Magento\Framework\Serialize\Serializer\Json $serializer = null
4857
) {
4958
$this->jsonDecoder = $jsonDecoder;
59+
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
60+
->get(\Magento\Framework\Serialize\Serializer\Json::class);
5061
parent::__construct(
5162
$context,
5263
$registry,
@@ -127,7 +138,7 @@ public function getConfig()
127138
{
128139
$config = $this->getData(self::CONFIG);
129140
if ($config) {
130-
return $this->jsonDecoder->decode($config);
141+
return $this->serializer->unserialize($config);
131142
}
132143
return [];
133144
}

0 commit comments

Comments
 (0)