Skip to content

Commit 4595aca

Browse files
authored
Merge pull request #1757 from algolia/feat/MAGE-1260-deprecated-cleanup
MAGE-1260: Remove deprecated methods/classes for 3.16
2 parents aef8860 + c867693 commit 4595aca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+547
-512
lines changed

Block/Algolia.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Algolia\AlgoliaSearch\Block;
44

5-
use Algolia\AlgoliaSearch\Helper\AlgoliaHelper;
65
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
76
use Algolia\AlgoliaSearch\Helper\Configuration\AutocompleteHelper;
87
use Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper;
@@ -15,6 +14,7 @@
1514
use Algolia\AlgoliaSearch\Model\LandingPage as LandingPageModel;
1615
use Algolia\AlgoliaSearch\Registry\CurrentCategory;
1716
use Algolia\AlgoliaSearch\Registry\CurrentProduct;
17+
use Algolia\AlgoliaSearch\Service\AlgoliaConnector;
1818
use Algolia\AlgoliaSearch\Service\Product\SortingTransformer;
1919
use Magento\Catalog\Api\Data\CategoryInterface;
2020
use Magento\Catalog\Api\Data\ProductInterface;
@@ -50,7 +50,7 @@ public function __construct(
5050
protected Currency $currency,
5151
protected Format $format,
5252
protected CurrentProduct $currentProduct,
53-
protected AlgoliaHelper $algoliaHelper,
53+
protected AlgoliaConnector $algoliaConnector,
5454
protected UrlHelper $urlHelper,
5555
protected FormKey $formKey,
5656
protected HttpContext $httpContext,
@@ -107,11 +107,6 @@ public function getCatalogSearchHelper(): CatalogSearchHelper
107107
return $this->catalogSearchHelper;
108108
}
109109

110-
public function getAlgoliaHelper(): AlgoliaHelper
111-
{
112-
return $this->algoliaHelper;
113-
}
114-
115110
public function getPersonalizationHelper(): PersonalizationHelper
116111
{
117112
return $this->personalizationHelper;
@@ -212,7 +207,7 @@ protected function getAddToCartUrl($additional = []): string
212207
$urlParamName = ActionInterface::PARAM_NAME_URL_ENCODED;
213208
$routeParams = [
214209
$urlParamName => $continueUrl,
215-
'_secure' => $this->algoliaHelper->getRequest()->isSecure(),
210+
'_secure' => $this->getRequest()->isSecure(),
216211
];
217212
if ($additional !== []) {
218213
$routeParams = array_merge($routeParams, $additional);

Block/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function getConfiguration()
8282

8383
$suggestionHelper = $this->getSuggestionHelper();
8484

85-
$algoliaHelper = $this->getAlgoliaHelper();
85+
$algoliaConnector = $this->algoliaConnector;
8686

8787
$persoHelper = $this->getPersonalizationHelper();
8888

@@ -225,7 +225,7 @@ public function getConfiguration()
225225
// Legacy misnomer - retained for backward compatibility
226226
'indexName' => $coreHelper->getBaseIndexName(),
227227
'baseIndexName' => $coreHelper->getBaseIndexName(),
228-
'apiKey' => $algoliaHelper->generateSearchSecuredApiKey(
228+
'apiKey' => $algoliaConnector->generateSearchSecuredApiKey(
229229
$config->getSearchOnlyAPIKey(),
230230
$attributesToFilter,
231231
$this->getStoreId()

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# CHANGE LOG
22

3+
## 3.16.0-beta.2
4+
5+
### Updates
6+
- Removed deprecated methods from Entity Helpers
7+
- Removed every calls to deprecated `AlgoliaHelper`'s methods in the codebase, `AlgoliaConnector` is now targeted directly. (`AlgoliaHelper` will be deleted in a future v3.17.0)
8+
- Updated integration tests
9+
10+
### Breaking Changes
11+
- `ProductHelper::setSettings()` is now taking `IndexOptions` objects as two first parameters instead of index names (strings).
12+
313
## 3.16.0-beta.1
414

515
### Features

Controller/Adminhtml/Reindex/Save.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Algolia\AlgoliaSearch\Helper\Data as DataHelper;
1111
use Algolia\AlgoliaSearch\Helper\Entity\ProductHelper;
1212
use Algolia\AlgoliaSearch\Service\Product\IndexBuilder as ProductIndexBuilder;
13+
use Algolia\AlgoliaSearch\Service\Product\RecordBuilder as ProductRecordBuilder;
1314
use Magento\Backend\App\Action\Context;
1415
use Magento\Catalog\Api\ProductRepositoryInterface;
1516
use Magento\Framework\Controller\ResultFactory;
@@ -27,6 +28,7 @@ public function __construct(
2728
protected StoreManagerInterface $storeManager,
2829
protected DataHelper $dataHelper,
2930
protected ProductHelper $productHelper,
31+
protected ProductRecordBuilder $productRecordBuilder,
3032
protected ProductIndexBuilder $productIndexBuilder
3133
) {
3234
parent::__construct($context);
@@ -147,7 +149,7 @@ protected function checkAndReindex($product, $stores)
147149

148150
try {
149151
$product = $this->productRepository->get($product->getSku(), false, $storeId);
150-
$this->productHelper->canProductBeReindexed($product, $storeId);
152+
$this->productRecordBuilder->canProductBeReindexed($product, $storeId);
151153
} catch (ProductDisabledException $e) {
152154
// Product status is a Website specific attribute
153155
$this->messageManager->addErrorMessage(

Helper/AlgoliaHelper.php

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Magento\Framework\Exception\NoSuchEntityException;
1616

1717
/**
18-
* @deprecated (will be removed in v3.16.0)
18+
* @deprecated (will be removed from the codebase in v3.17.0)
1919
*/
2020
class AlgoliaHelper extends AbstractHelper
2121
{

Helper/Entity/CategoryHelper.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Algolia\AlgoliaSearch\Service\Category\RecordBuilder as CategoryRecordBuilder;
99
use Algolia\AlgoliaSearch\Service\IndexNameFetcher;
1010
use Magento\Catalog\Model\Category;
11-
use Magento\Catalog\Model\Category as MagentoCategory;
1211
use Magento\Catalog\Model\CategoryRepository;
1312
use Magento\Catalog\Model\ResourceModel\Category\Collection as CategoryCollection;
1413
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
@@ -197,18 +196,6 @@ public function getAllAttributes()
197196
return $this->categoryAttributes;
198197
}
199198

200-
/**
201-
* @param MagentoCategory $category
202-
* @return array|mixed|null
203-
* @throws LocalizedException
204-
*
205-
* @deprecated (will be removed in v3.16.0)
206-
*/
207-
public function getObject(Category $category)
208-
{
209-
return $this->categoryRecordBuilder->buildRecord($category);
210-
}
211-
212199
/**
213200
* @return int|mixed
214201
* @throws LocalizedException
@@ -259,23 +246,9 @@ public function isCategoryActive($category, $storeId = null)
259246
*
260247
* @return string|null
261248
*
262-
* @deprecated (will be removed in v3.16.0)
263249
*/
264250
public function getCategoryName($categoryId, $storeId = null)
265251
{
266252
return $this->categoryRecordBuilder->getCategoryName($categoryId, $storeId);
267253
}
268-
269-
/**
270-
* @param $filterNotIncludedCategories
271-
* @param $storeId
272-
* @return array
273-
* @throws LocalizedException
274-
*
275-
* @deprecated (will be removed in v3.16.0)
276-
*/
277-
public function getCoreCategories($filterNotIncludedCategories = true, $storeId = null)
278-
{
279-
return $this->categoryRecordBuilder->getCoreCategories($filterNotIncludedCategories, $storeId);
280-
}
281254
}

0 commit comments

Comments
 (0)