Skip to content

Commit

Permalink
Changed some classes in order to attend to some incompatibilities inc…
Browse files Browse the repository at this point in the history
…luded in 2.4.6 version (#262)
  • Loading branch information
Aitor-Corrales committed Mar 28, 2023
1 parent efa29d0 commit f9d9d3c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions ApiClient/ManagementClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public function listSearchEngines(): array
{
$response = $this->client->get(self::ENDPOINT_SEARCH_ENGINES);

return \Zend_Json::decode($response);
return json_decode($response, true);
}

public function createStore(array $storeData): array
{
$response = $this->client->post('/plugins/create-store', $storeData);

return \Zend_Json::decode($response);
return json_decode($response, true);
}

/**
Expand All @@ -77,7 +77,7 @@ public function createSearchEngine(array $searchEngine): array
{
$response = $this->client->post(self::ENDPOINT_SEARCH_ENGINES, $searchEngine);

return \Zend_Json::decode($response);
return json_decode($response, true);
}

/**
Expand All @@ -102,7 +102,7 @@ public function processSearchEngine(string $hashId, string $callbackUrl = null):
$path = $this->getProcessSearchEnginePath($hashId);
$response = $this->client->post($path, ['callback_url' => $callbackUrl]);

return \Zend_Json::decode($response);
return json_decode($response, true);
}

/**
Expand All @@ -124,7 +124,7 @@ public function getSearchEngine(string $hashid): array
{
$url = $this->getSearchEnginePath($hashid);
$response = $this->client->get($url);
return \Zend_Json::decode($response);
return json_decode($response, true);
}

/**
Expand All @@ -148,7 +148,7 @@ public function createIndice(array $indice, string $hashId): array
{
$response = $this->client->post($this->getIndicesPath($hashId), $indice);

return \Zend_Json::decode($response);
return json_decode($response, true);
}

/**
Expand All @@ -174,7 +174,7 @@ public function createItemsInBulk(array $items, string $hashId, string $indice):
$path = $this->getItemsBulkPath($hashId, $indice);
$response = $this->client->post($path, $items);

return \Zend_Json::decode($response);
return json_decode($response, true);
}

/**
Expand All @@ -200,7 +200,7 @@ public function updateItemsInBulk(array $items, string $hashId, string $indice):
$path = $this->getItemsBulkPath($hashId, $indice);
$response = $this->client->post($path, $items);

return \Zend_Json::decode($response);
return json_decode($response, true);
}

/**
Expand All @@ -226,7 +226,7 @@ public function deleteItemsInBulk(array $items, string $hashId, string $indice):
$path = $this->getItemsBulkPath($hashId, $indice);
$response = $this->client->delete($path, $items);

return \Zend_Json::decode($response);
return json_decode($response, true);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Integration/CreateStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private function setCustomAttributes()
];
}

$customAttributes = \Zend_Json::encode($attributes);
$customAttributes = \Laminas\Json\Json::encode($attributes);
$this->storeConfig->setCustomAttributes($customAttributes);
}

Expand Down
6 changes: 3 additions & 3 deletions Cron/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private function createProducts($store, $indice)
if (count($items)) {
try {
$this->logger->debug('[CreateInBulk]');
$this->logger->debug(\Zend_Json::encode($items));
$this->logger->debug(\Laminas\Json\Json::encode($items));
$this->itemHelper->createItemsInBulk($items, $store, $indice);
} catch (\Exception $e) {
$this->logger->error(
Expand Down Expand Up @@ -136,7 +136,7 @@ private function updateProducts($store, $indice)
if (count($items)) {
try {
$this->logger->debug('[UpdateInBulk]');
$this->logger->debug(\Zend_Json::encode($items));
$this->logger->debug(\Laminas\Json\Json::encode($items));
$this->itemHelper->updateItemsInBulk($items, $store, $indice);
} catch (\Exception $e) {
$this->logger->error(
Expand Down Expand Up @@ -164,7 +164,7 @@ private function deleteProducts($store, $indice)
if (count($items)) {
try {
$this->logger->debug('[DeleteInBulk]');
$this->logger->debug(\Zend_Json::encode($items));
$this->logger->debug(\Laminas\Json\Json::encode($items));
$this->itemHelper->deleteItemsInBulk($items, $store, $indice);
} catch (\Exception $e) {
$this->logger->error(
Expand Down
2 changes: 1 addition & 1 deletion Errors/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function handleErrors($statusCode, $response)

private static function readError($response): string
{
$error = \Zend_Json::decode($response);
$error = json_decode($response, true);
if ($error === null || !isset($error['error']['message'])) {
$error = $response;
} else {
Expand Down
6 changes: 3 additions & 3 deletions Helper/StoreConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ public function getCustomAttributes(?int $id = null, ?string $scope = ScopeInter
}

$custom_attributes = $this->scopeConfig->getValue(self::CUSTOM_ATTRIBUTES, $scope, $id);
$custom_attributes = ($custom_attributes) ? \Zend_Json::decode($custom_attributes) : null;
$custom_attributes = ($custom_attributes) ? json_decode($custom_attributes, true) : null;
$saved = [];
if ($custom_attributes && is_array($custom_attributes)) {
foreach ($custom_attributes as $rowId => $row) {
Expand Down Expand Up @@ -900,7 +900,7 @@ public function setCustomAttributes(string $customAttributes) {
public function getIndexationStatus(int $storeId): array {
try {
$status = $this->scopeConfig->getValue(self::INDEXATION_STATUS, ScopeInterface::SCOPE_STORES, $storeId);
return \Zend_Json::decode($status);
return json_decode($status, true);
} catch (\Exception $e){
throw new NotFound('There is not a valid indexation status for the current store.');
}
Expand All @@ -911,7 +911,7 @@ public function getIndexationStatus(int $storeId): array {
*/
public function setIndexationStatus(array $status, int $storeId){
$status = $this->indexationHelper->sanitizeProcessTaskStatus($status);
$status = \Zend_Json::encode($status);
$status = \Laminas\Json\Json::encode($status);
$this->configWriter->save(self::INDEXATION_STATUS, $status, ScopeInterface::SCOPE_STORES, $storeId);
}

Expand Down

0 comments on commit f9d9d3c

Please sign in to comment.