Skip to content

Commit a2cba8c

Browse files
committed
MAGE-986 Group deprecated constants / methods and fix namespacing
1 parent 853e9eb commit a2cba8c

File tree

1 file changed

+113
-110
lines changed

1 file changed

+113
-110
lines changed

Helper/ConfigHelper.php

Lines changed: 113 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
use Algolia\AlgoliaSearch\Helper\Configuration\AutocompleteHelper;
77
use Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper;
88
use Algolia\AlgoliaSearch\Service\AlgoliaConnector;
9-
use Magento;
109
use Magento\Cookie\Helper\Cookie as CookieHelper;
10+
use Magento\Customer\Api\GroupExcludedWebsiteRepositoryInterface;
11+
use Magento\Customer\Model\ResourceModel\Group\Collection as GroupCollection;
1112
use Magento\Directory\Model\Currency as DirCurrency;
1213
use Magento\Framework\App\Config\ScopeConfigInterface;
1314
use Magento\Framework\App\Filesystem\DirectoryList;
@@ -16,8 +17,6 @@
1617
use Magento\Framework\Serialize\SerializerInterface;
1718
use Magento\Store\Model\ScopeInterface;
1819
use Magento\Store\Model\StoreManagerInterface;
19-
use Magento\Customer\Api\GroupExcludedWebsiteRepositoryInterface;
20-
use Magento\Customer\Model\ResourceModel\Group\Collection as GroupCollection;
2120

2221
class ConfigHelper
2322
{
@@ -143,21 +142,21 @@ class ConfigHelper
143142
public const ENABLE_INDEXER_QUEUE = 'algoliasearch_indexing_manager/full_indexing/queue';
144143

145144
public function __construct(
146-
protected Magento\Framework\App\Config\ScopeConfigInterface $configInterface,
147-
protected Magento\Framework\App\Config\Storage\WriterInterface $configWriter,
148-
protected StoreManagerInterface $storeManager,
149-
protected Currency $currency,
150-
protected DirCurrency $dirCurrency,
151-
protected DirectoryList $directoryList,
152-
protected Magento\Framework\Module\ResourceInterface $moduleResource,
153-
protected Magento\Framework\App\ProductMetadataInterface $productMetadata,
154-
protected Magento\Framework\Event\ManagerInterface $eventManager,
155-
protected SerializerInterface $serializer,
156-
protected GroupCollection $groupCollection,
157-
protected GroupExcludedWebsiteRepositoryInterface $groupExcludedWebsiteRepository,
158-
protected CookieHelper $cookieHelper,
159-
protected AutocompleteHelper $autocompleteConfig,
160-
protected InstantSearchHelper $instantSearchConfig
145+
protected \Magento\Framework\App\Config\ScopeConfigInterface $configInterface,
146+
protected \Magento\Framework\App\Config\Storage\WriterInterface $configWriter,
147+
protected StoreManagerInterface $storeManager,
148+
protected Currency $currency,
149+
protected DirCurrency $dirCurrency,
150+
protected DirectoryList $directoryList,
151+
protected \Magento\Framework\Module\ResourceInterface $moduleResource,
152+
protected \Magento\Framework\App\ProductMetadataInterface $productMetadata,
153+
protected \Magento\Framework\Event\ManagerInterface $eventManager,
154+
protected SerializerInterface $serializer,
155+
protected GroupCollection $groupCollection,
156+
protected GroupExcludedWebsiteRepositoryInterface $groupExcludedWebsiteRepository,
157+
protected CookieHelper $cookieHelper,
158+
protected AutocompleteHelper $autocompleteConfig,
159+
protected InstantSearchHelper $instantSearchConfig
161160
)
162161
{}
163162

@@ -784,11 +783,11 @@ public function getCategoryPageIdAttributeName($storeId = null): string
784783
}
785784

786785
/**
787-
* @throws Magento\Framework\Exception\NoSuchEntityException
786+
* @throws \Magento\Framework\Exception\NoSuchEntityException
788787
*/
789788
public function getCurrencyCode(int $storeId = null): string
790789
{
791-
/** @var Magento\Store\Model\Store $store */
790+
/** @var \Magento\Store\Model\Store $store */
792791
$store = $this->storeManager->getStore($storeId);
793792
return $store->getCurrentCurrencyCode();
794793
}
@@ -1022,7 +1021,7 @@ public function getBackendRenderingDisplayMode($storeId = null)
10221021

10231022
/**
10241023
* @return int
1025-
* @throws Magento\Framework\Exception\NoSuchEntityException
1024+
* @throws \Magento\Framework\Exception\NoSuchEntityException
10261025
*/
10271026
public function getStoreId()
10281027
{
@@ -1045,11 +1044,11 @@ public function getStoreLocale($storeId)
10451044
/**
10461045
* @param $storeId
10471046
* @return string|null
1048-
* @throws Magento\Framework\Exception\NoSuchEntityException
1047+
* @throws \Magento\Framework\Exception\NoSuchEntityException
10491048
*/
10501049
public function getCurrency($storeId = null)
10511050
{
1052-
/** @var Magento\Store\Model\Store $store */
1051+
/** @var \Magento\Store\Model\Store $store */
10531052
$store = $this->storeManager->getStore($storeId);
10541053
return $this->currency->getCurrency($store->getCurrentCurrencyCode())->getSymbol();
10551054
}
@@ -1573,7 +1572,7 @@ public function isQueueIndexerEnabled(): bool
15731572
* DEPRECATED CONSTANTS & METHODS *
15741573
**************************************/
15751574

1576-
// --- AUTOCOMPLETE --- //
1575+
// --- Autocomplete --- //
15771576

15781577
/**
15791578
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
@@ -1653,6 +1652,93 @@ public function isQueueIndexerEnabled(): bool
16531652
*/
16541653
public const AUTOCOMPLETE_MINIMUM_CHAR_LENGTH = AutocompleteHelper::MINIMUM_CHAR_LENGTH;
16551654

1655+
// --- InstantSearch --- //
1656+
1657+
/**
1658+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1659+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::IS_ENABLED
1660+
*/
1661+
public const IS_INSTANT_ENABLED = InstantSearchHelper::IS_ENABLED;
1662+
1663+
/**
1664+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1665+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::DOM_SELECTOR
1666+
*/
1667+
public const INSTANT_SELECTOR = InstantSearchHelper::DOM_SELECTOR;
1668+
1669+
/**
1670+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1671+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::NUMBER_OF_PRODUCT_RESULTS
1672+
*/
1673+
public const NUMBER_OF_PRODUCT_RESULTS = InstantSearchHelper::NUMBER_OF_PRODUCT_RESULTS;
1674+
1675+
/**
1676+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1677+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::REPLACE_CATEGORIES
1678+
*/
1679+
public const REPLACE_CATEGORIES = InstantSearchHelper::REPLACE_CATEGORIES;
1680+
1681+
/**
1682+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1683+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::FACETS
1684+
*/
1685+
public const FACETS = InstantSearchHelper::FACETS;
1686+
1687+
/**
1688+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1689+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::MAX_VALUES_PER_FACET
1690+
*/
1691+
public const MAX_VALUES_PER_FACET = InstantSearchHelper::MAX_VALUES_PER_FACET;
1692+
1693+
/**
1694+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1695+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::IS_DYNAMIC_FACETS_ENABLED
1696+
*/
1697+
public const ENABLE_DYNAMIC_FACETS = InstantSearchHelper::IS_DYNAMIC_FACETS_ENABLED;
1698+
1699+
/**
1700+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1701+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::SORTING_INDICES
1702+
*/
1703+
public const SORTING_INDICES = InstantSearchHelper::SORTING_INDICES;
1704+
1705+
/**
1706+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1707+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::SHOW_SUGGESTIONS_NO_RESULTS
1708+
*/
1709+
public const SHOW_SUGGESTIONS_NO_RESULTS = InstantSearchHelper::SHOW_SUGGESTIONS_NO_RESULTS;
1710+
1711+
/**
1712+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1713+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::IS_SEARCHBOX_ENABLED
1714+
*/
1715+
public const SEARCHBOX_ENABLE = InstantSearchHelper::IS_SEARCHBOX_ENABLED;
1716+
1717+
/**
1718+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1719+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::IS_ADD_TO_CART_ENABLED
1720+
*/
1721+
public const XML_ADD_TO_CART_ENABLE = InstantSearchHelper::IS_ADD_TO_CART_ENABLED;
1722+
1723+
/**
1724+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1725+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::IS_INFINITE_SCROLL_ENABLED
1726+
*/
1727+
public const INFINITE_SCROLL_ENABLE = InstantSearchHelper::IS_INFINITE_SCROLL_ENABLED;
1728+
1729+
/**
1730+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1731+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::HIDE_PAGINATION
1732+
*/
1733+
public const HIDE_PAGINATION = InstantSearchHelper::HIDE_PAGINATION;
1734+
1735+
/**
1736+
* @deprecated This constant is retained purely for data patches to migrate from older versions
1737+
*/
1738+
public const LEGACY_USE_VIRTUAL_REPLICA_ENABLED = 'algoliasearch_instant/instant/use_virtual_replica';
1739+
1740+
// --- Autocomplete --- //
1741+
16561742
/**
16571743
* @param $storeId
16581744
* @return bool
@@ -1813,90 +1899,7 @@ public function getAutocompleteMinimumCharacterLength(?int $storeId = null): int
18131899
return $this->autocompleteConfig->getMinimumCharacterLength($storeId);
18141900
}
18151901

1816-
// --- InstantSearch ---
1817-
1818-
/**
1819-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1820-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::IS_ENABLED
1821-
*/
1822-
public const IS_INSTANT_ENABLED = InstantSearchHelper::IS_ENABLED;
1823-
1824-
/**
1825-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1826-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::DOM_SELECTOR
1827-
*/
1828-
public const INSTANT_SELECTOR = InstantSearchHelper::DOM_SELECTOR;
1829-
1830-
/**
1831-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1832-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::NUMBER_OF_PRODUCT_RESULTS
1833-
*/
1834-
public const NUMBER_OF_PRODUCT_RESULTS = InstantSearchHelper::NUMBER_OF_PRODUCT_RESULTS;
1835-
1836-
/**
1837-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1838-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::REPLACE_CATEGORIES
1839-
*/
1840-
public const REPLACE_CATEGORIES = InstantSearchHelper::REPLACE_CATEGORIES;
1841-
1842-
/**
1843-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1844-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::FACETS
1845-
*/
1846-
public const FACETS = InstantSearchHelper::FACETS;
1847-
1848-
/**
1849-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1850-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::MAX_VALUES_PER_FACET
1851-
*/
1852-
public const MAX_VALUES_PER_FACET = InstantSearchHelper::MAX_VALUES_PER_FACET;
1853-
1854-
/**
1855-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1856-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::IS_DYNAMIC_FACETS_ENABLED
1857-
*/
1858-
public const ENABLE_DYNAMIC_FACETS = InstantSearchHelper::IS_DYNAMIC_FACETS_ENABLED;
1859-
1860-
/**
1861-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1862-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::SORTING_INDICES
1863-
*/
1864-
public const SORTING_INDICES = InstantSearchHelper::SORTING_INDICES;
1865-
1866-
/**
1867-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1868-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::SHOW_SUGGESTIONS_NO_RESULTS
1869-
*/
1870-
public const SHOW_SUGGESTIONS_NO_RESULTS = InstantSearchHelper::SHOW_SUGGESTIONS_NO_RESULTS;
1871-
1872-
/**
1873-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1874-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::IS_SEARCHBOX_ENABLED
1875-
*/
1876-
public const SEARCHBOX_ENABLE = InstantSearchHelper::IS_SEARCHBOX_ENABLED;
1877-
1878-
/**
1879-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1880-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::IS_ADD_TO_CART_ENABLED
1881-
*/
1882-
public const XML_ADD_TO_CART_ENABLE = InstantSearchHelper::IS_ADD_TO_CART_ENABLED;
1883-
1884-
/**
1885-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1886-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::IS_INFINITE_SCROLL_ENABLED
1887-
*/
1888-
public const INFINITE_SCROLL_ENABLE = InstantSearchHelper::IS_INFINITE_SCROLL_ENABLED;
1889-
1890-
/**
1891-
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1892-
* @see \Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper::HIDE_PAGINATION
1893-
*/
1894-
public const HIDE_PAGINATION = InstantSearchHelper::HIDE_PAGINATION;
1895-
1896-
/**
1897-
* @deprecated This constant is retained purely for data patches to migrate from older versions
1898-
*/
1899-
public const LEGACY_USE_VIRTUAL_REPLICA_ENABLED = 'algoliasearch_instant/instant/use_virtual_replica';
1902+
// --- InstantSearch --- //
19001903

19011904
/**
19021905
* @param $storeId
@@ -1982,8 +1985,8 @@ public function isDynamicFacetsEnabled(?int $storeId = null): bool
19821985
* @param $currentCustomerGroupId
19831986
* @param $attrs
19841987
* @return array
1985-
* @throws Magento\Framework\Exception\LocalizedException
1986-
* @throws Magento\Framework\Exception\NoSuchEntityException
1988+
* @throws \Magento\Framework\Exception\LocalizedException
1989+
* @throws \Magento\Framework\Exception\NoSuchEntityException
19871990
* @deprecated This method has been deprecated and should no longer be used
19881991
* @see \Algolia\AlgoliaSearch\Service\Product\SortingTransformer
19891992
*/

0 commit comments

Comments
 (0)