6
6
use Algolia \AlgoliaSearch \Helper \Configuration \AutocompleteHelper ;
7
7
use Algolia \AlgoliaSearch \Helper \Configuration \InstantSearchHelper ;
8
8
use Algolia \AlgoliaSearch \Service \AlgoliaConnector ;
9
+ use Algolia \AlgoliaSearch \Service \Serializer ;
9
10
use Magento \Cookie \Helper \Cookie as CookieHelper ;
10
11
use Magento \Customer \Api \GroupExcludedWebsiteRepositoryInterface ;
11
12
use Magento \Customer \Model \ResourceModel \Group \Collection as GroupCollection ;
14
15
use Magento \Framework \App \Filesystem \DirectoryList ;
15
16
use Magento \Framework \DataObject ;
16
17
use Magento \Framework \Locale \Currency ;
17
- use Magento \Framework \Serialize \SerializerInterface ;
18
18
use Magento \Store \Model \ScopeInterface ;
19
19
use Magento \Store \Model \StoreManagerInterface ;
20
20
@@ -151,7 +151,7 @@ public function __construct(
151
151
protected \Magento \Framework \Module \ResourceInterface $ moduleResource ,
152
152
protected \Magento \Framework \App \ProductMetadataInterface $ productMetadata ,
153
153
protected \Magento \Framework \Event \ManagerInterface $ eventManager ,
154
- protected SerializerInterface $ serializer ,
154
+ protected Serializer $ serializer ,
155
155
protected GroupCollection $ groupCollection ,
156
156
protected GroupExcludedWebsiteRepositoryInterface $ groupExcludedWebsiteRepository ,
157
157
protected CookieHelper $ cookieHelper ,
@@ -366,28 +366,6 @@ public function isPartialUpdateEnabled($storeId = null)
366
366
return $ this ->configInterface ->isSetFlag (self ::PARTIAL_UPDATES , ScopeInterface::SCOPE_STORE , $ storeId );
367
367
}
368
368
369
-
370
-
371
- protected function serialize (array $ value ): string {
372
- return $ this ->serializer ->serialize ($ value ) ?: '' ;
373
- }
374
-
375
- /**
376
- * @param $value
377
- * @return array|bool|float|int|mixed|string|null
378
- */
379
- protected function unserialize ($ value )
380
- {
381
- if (false === $ value || null === $ value || '' === $ value ) {
382
- return false ;
383
- }
384
- $ unserialized = json_decode ($ value , true );
385
- if (json_last_error () === JSON_ERROR_NONE ) {
386
- return $ unserialized ;
387
- }
388
- return $ this ->serializer ->unserialize ($ value );
389
- }
390
-
391
369
/**
392
370
* @param $storeId
393
371
* @return bool
@@ -918,7 +896,7 @@ public function isAutoPriceIndexingEnabled(?int $storeId = null): bool
918
896
*/
919
897
public function getCategoryCustomRanking ($ storeId = null )
920
898
{
921
- $ attrs = $ this ->unserialize ($ this ->configInterface ->getValue (
899
+ $ attrs = $ this ->serializer -> unserialize ($ this ->configInterface ->getValue (
922
900
self ::CATEGORY_CUSTOM_RANKING ,
923
901
ScopeInterface::SCOPE_STORE ,
924
902
$ storeId
@@ -935,7 +913,7 @@ public function getCategoryCustomRanking($storeId = null)
935
913
*/
936
914
public function getProductCustomRanking ($ storeId = null )
937
915
{
938
- $ attrs = $ this ->unserialize ($ this ->getRawProductCustomRanking ($ storeId ));
916
+ $ attrs = $ this ->serializer -> unserialize ($ this ->getRawProductCustomRanking ($ storeId ));
939
917
if (is_array ($ attrs )) {
940
918
return $ attrs ;
941
919
}
@@ -1137,27 +1115,27 @@ public function getAttributesToRetrieve($groupId)
1137
1115
*/
1138
1116
public function getProductAdditionalAttributes ($ storeId = null )
1139
1117
{
1140
- $ attributes = $ this ->unserialize ($ this ->configInterface ->getValue (
1118
+ $ attributes = $ this ->serializer -> unserialize ($ this ->configInterface ->getValue (
1141
1119
self ::PRODUCT_ATTRIBUTES ,
1142
1120
ScopeInterface::SCOPE_STORE ,
1143
1121
$ storeId
1144
1122
));
1145
1123
1146
- $ facets = $ this ->unserialize ($ this ->configInterface ->getValue (
1124
+ $ facets = $ this ->serializer -> unserialize ($ this ->configInterface ->getValue (
1147
1125
self ::FACETS ,
1148
1126
ScopeInterface::SCOPE_STORE ,
1149
1127
$ storeId
1150
1128
));
1151
1129
$ attributes = $ this ->addIndexableAttributes ($ attributes , $ facets , '0 ' );
1152
1130
1153
- $ sorts = $ this ->unserialize ($ this ->configInterface ->getValue (
1131
+ $ sorts = $ this ->serializer -> unserialize ($ this ->configInterface ->getValue (
1154
1132
self ::SORTING_INDICES ,
1155
1133
ScopeInterface::SCOPE_STORE ,
1156
1134
$ storeId
1157
1135
));
1158
1136
$ attributes = $ this ->addIndexableAttributes ($ attributes , $ sorts , '0 ' );
1159
1137
1160
- $ customRankings = $ this ->unserialize ($ this ->configInterface ->getValue (
1138
+ $ customRankings = $ this ->serializer -> unserialize ($ this ->configInterface ->getValue (
1161
1139
self ::PRODUCT_CUSTOM_RANKING ,
1162
1140
ScopeInterface::SCOPE_STORE ,
1163
1141
$ storeId
@@ -1210,12 +1188,12 @@ protected function addIndexableAttributes(
1210
1188
*/
1211
1189
public function getCategoryAdditionalAttributes ($ storeId = null )
1212
1190
{
1213
- $ attributes = $ this ->unserialize ($ this ->configInterface ->getValue (
1191
+ $ attributes = $ this ->serializer -> unserialize ($ this ->configInterface ->getValue (
1214
1192
self ::CATEGORY_ATTRIBUTES ,
1215
1193
ScopeInterface::SCOPE_STORE ,
1216
1194
$ storeId
1217
1195
));
1218
- $ customRankings = $ this ->unserialize ($ this ->configInterface ->getValue (
1196
+ $ customRankings = $ this ->serializer -> unserialize ($ this ->configInterface ->getValue (
1219
1197
self ::CATEGORY_CUSTOM_RANKING ,
1220
1198
ScopeInterface::SCOPE_STORE ,
1221
1199
$ storeId
@@ -1374,7 +1352,7 @@ public function isAnalyticsEnabled($storeId = null)
1374
1352
public function getNonCastableAttributes ($ storeId = null )
1375
1353
{
1376
1354
$ nonCastableAttributes = [];
1377
- $ config = $ this ->unserialize ($ this ->configInterface ->getValue (
1355
+ $ config = $ this ->serializer -> unserialize ($ this ->configInterface ->getValue (
1378
1356
self ::NON_CASTABLE_ATTRIBUTES ,
1379
1357
ScopeInterface::SCOPE_STORE ,
1380
1358
$ storeId
0 commit comments