Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API Changes] Remove deprecated interfaces part 1 #32794

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/code/Magento/AdvancedSearch/Block/SearchData.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Magento\AdvancedSearch\Block;

use Magento\Framework\View\Element\Template;
use Magento\Search\Model\QueryFactoryInterface;
use Magento\Search\Model\QueryFactory;
use Magento\Search\Model\QueryInterface;
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;

Expand Down Expand Up @@ -35,14 +35,14 @@ abstract class SearchData extends Template implements SearchDataInterface
/**
* @param Template\Context $context
* @param SuggestedQueriesInterface $searchDataProvider
* @param QueryFactoryInterface $queryFactory
* @param QueryFactory $queryFactory
* @param string $title
* @param array $data
*/
public function __construct(
Template\Context $context,
SuggestedQueriesInterface $searchDataProvider,
QueryFactoryInterface $queryFactory,
QueryFactory $queryFactory,
$title,
array $data = []
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Magento\AdvancedSearch\Block\SearchData;
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;
use Magento\Framework\View\Element\Template\Context as TemplateContext;
use Magento\Search\Model\QueryFactoryInterface;
use Magento\Search\Model\QueryFactory;
use Magento\Search\Model\QueryInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -33,7 +33,7 @@ class SearchDataTest extends TestCase
private $contextMock;

/**
* @var QueryFactoryInterface|MockObject
* @var QueryFactory|MockObject
*/
private $queryFactoryMock;

Expand All @@ -58,7 +58,7 @@ protected function setUp(): void
->disableOriginalConstructor()
->setMethods(['getQueryText'])
->getMockForAbstractClass();
$this->queryFactoryMock = $this->getMockBuilder(QueryFactoryInterface::class)
$this->queryFactoryMock = $this->getMockBuilder(QueryFactory::class)
->disableOriginalConstructor()
->setMethods(['get'])
->getMockForAbstractClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Magento\Eav\Model\Config;
use Magento\Framework\DB\Select;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Store\Api\StoreResolverInterface;
use Magento\Store\Model\StoreResolver;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManagerInterface;

Expand All @@ -38,15 +38,15 @@ class StatusBaseSelectProcessor implements BaseSelectProcessorInterface
/**
* @param Config $eavConfig
* @param MetadataPool $metadataPool
* @param StoreResolverInterface $storeResolver
* @param StoreResolver $storeResolver
* @param StoreManagerInterface $storeManager
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(
Config $eavConfig,
MetadataPool $metadataPool,
StoreResolverInterface $storeResolver,
StoreResolver $storeResolver,
StoreManagerInterface $storeManager = null
) {
$this->eavConfig = $eavConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitationFactory;
use Magento\CatalogSearch\Model\ResourceModel\Advanced;
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\DefaultFilterStrategyApplyChecker;
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\DefaultFilterStrategyApplyCheckerInterface;
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\SearchCriteriaResolverFactory;
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\SearchCriteriaResolverInterface;
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplierFactory;
Expand Down Expand Up @@ -104,11 +102,6 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
*/
private $searchOrders;

/**
* @var DefaultFilterStrategyApplyCheckerInterface
*/
private $defaultFilterStrategyApplyChecker;

/**
* @var Advanced
*/
Expand Down Expand Up @@ -148,7 +141,6 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
* @param SearchResultApplierFactory|null $searchResultApplierFactory
* @param TotalRecordsResolverFactory|null $totalRecordsResolverFactory
* @param EngineResolverInterface|null $engineResolver
* @param DefaultFilterStrategyApplyCheckerInterface|null $defaultFilterStrategyApplyChecker
* @param Advanced|null $advancedSearchResource
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
Expand Down Expand Up @@ -185,7 +177,6 @@ public function __construct(
SearchResultApplierFactory $searchResultApplierFactory = null,
TotalRecordsResolverFactory $totalRecordsResolverFactory = null,
EngineResolverInterface $engineResolver = null,
DefaultFilterStrategyApplyCheckerInterface $defaultFilterStrategyApplyChecker = null,
Advanced $advancedSearchResource = null
) {
$this->searchRequestName = $searchRequestName;
Expand All @@ -201,8 +192,6 @@ public function __construct(
->get(TotalRecordsResolverFactory::class);
$this->engineResolver = $engineResolver ?: ObjectManager::getInstance()
->get(EngineResolverInterface::class);
$this->defaultFilterStrategyApplyChecker = $defaultFilterStrategyApplyChecker ?: ObjectManager::getInstance()
->get(DefaultFilterStrategyApplyChecker::class);
$this->advancedSearchResource = $advancedSearchResource ?: ObjectManager::getInstance()
->get(Advanced::class);
parent::__construct(
Expand Down Expand Up @@ -257,9 +246,6 @@ public function setOrder($attribute, $dir = Select::SQL_DESC)
* for price aggregation process.
*/
$this->setSearchOrder($attribute, $dir);
if ($this->defaultFilterStrategyApplyChecker->isApplicable()) {
parent::setOrder($attribute, $dir);
}

return $this;
}
Expand All @@ -271,15 +257,8 @@ public function setOrder($attribute, $dir = Select::SQL_DESC)
public function addCategoryFilter(\Magento\Catalog\Model\Category $category)
{
$this->setAttributeFilterData(Category::ENTITY, 'category_ids', $category->getId());
/**
* This changes need in backward compatible reasons for support dynamic improved algorithm
* for price aggregation process.
*/
if ($this->defaultFilterStrategyApplyChecker->isApplicable()) {
parent::addCategoryFilter($category);
} else {
$this->_productLimitationPrice();
}

$this->_productLimitationPrice();

return $this;
}
Expand All @@ -291,13 +270,6 @@ public function addCategoryFilter(\Magento\Catalog\Model\Category $category)
public function setVisibility($visibility)
{
$this->setAttributeFilterData(Product::ENTITY, 'visibility', $visibility);
/**
* This changes need in backward compatible reasons for support dynamic improved algorithm
* for price aggregation process.
*/
if ($this->defaultFilterStrategyApplyChecker->isApplicable()) {
parent::setVisibility($visibility);
}

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

namespace Magento\CatalogSearch\Model\ResourceModel\Fulltext;

use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\DefaultFilterStrategyApplyChecker;
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\DefaultFilterStrategyApplyCheckerInterface;
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\TotalRecordsResolverInterface;
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\TotalRecordsResolverFactory;
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\SearchCriteriaResolverInterface;
Expand Down Expand Up @@ -95,11 +93,6 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
*/
private $searchOrders;

/**
* @var DefaultFilterStrategyApplyCheckerInterface
*/
private $defaultFilterStrategyApplyChecker;

/**
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -135,7 +128,6 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
* @param SearchCriteriaResolverFactory|null $searchCriteriaResolverFactory
* @param SearchResultApplierFactory|null $searchResultApplierFactory
* @param TotalRecordsResolverFactory|null $totalRecordsResolverFactory
* @param DefaultFilterStrategyApplyCheckerInterface|null $defaultFilterStrategyApplyChecker
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
Expand Down Expand Up @@ -174,8 +166,7 @@ public function __construct(
\Magento\Framework\Api\FilterBuilder $filterBuilder = null,
SearchCriteriaResolverFactory $searchCriteriaResolverFactory = null,
SearchResultApplierFactory $searchResultApplierFactory = null,
TotalRecordsResolverFactory $totalRecordsResolverFactory = null,
DefaultFilterStrategyApplyCheckerInterface $defaultFilterStrategyApplyChecker = null
TotalRecordsResolverFactory $totalRecordsResolverFactory = null
) {
$this->searchResultFactory = $searchResultFactory ?? \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Api\Search\SearchResultFactory::class);
Expand Down Expand Up @@ -215,8 +206,6 @@ public function __construct(
->get(SearchResultApplierFactory::class);
$this->totalRecordsResolverFactory = $totalRecordsResolverFactory ?: ObjectManager::getInstance()
->get(TotalRecordsResolverFactory::class);
$this->defaultFilterStrategyApplyChecker = $defaultFilterStrategyApplyChecker ?: ObjectManager::getInstance()
->get(DefaultFilterStrategyApplyChecker::class);
}

/**
Expand Down Expand Up @@ -419,9 +408,6 @@ public function addSearchFilter($query)
public function setOrder($attribute, $dir = Select::SQL_DESC)
{
$this->setSearchOrder($attribute, $dir);
if ($this->defaultFilterStrategyApplyChecker->isApplicable()) {
parent::setOrder($attribute, $dir);
}

return $this;
}
Expand All @@ -436,11 +422,7 @@ public function setOrder($attribute, $dir = Select::SQL_DESC)
*/
public function addAttributeToSort($attribute, $dir = self::SORT_ORDER_ASC)
{
if ($this->defaultFilterStrategyApplyChecker->isApplicable()) {
parent::addAttributeToSort($attribute, $dir);
} else {
$this->setOrder($attribute, $dir);
}
$this->setOrder($attribute, $dir);

return $this;
}
Expand Down Expand Up @@ -629,16 +611,9 @@ public function getFacetedData($field)
public function addCategoryFilter(\Magento\Catalog\Model\Category $category)
{
$this->addFieldToFilter('category_ids', $category->getId());
/**
* This changes need in backward compatible reasons for support dynamic improved algorithm
* for price aggregation process.
*/
if ($this->defaultFilterStrategyApplyChecker->isApplicable()) {
parent::addCategoryFilter($category);
} else {
$this->setFlag('has_category_filter', true);
$this->_productLimitationPrice();
}

$this->setFlag('has_category_filter', true);
$this->_productLimitationPrice();

return $this;
}
Expand All @@ -652,13 +627,6 @@ public function addCategoryFilter(\Magento\Catalog\Model\Category $category)
public function setVisibility($visibility)
{
$this->addFieldToFilter('visibility', $visibility);
/**
* This changes need in backward compatible reasons for support dynamic improved algorithm
* for price aggregation process.
*/
if ($this->defaultFilterStrategyApplyChecker->isApplicable()) {
parent::setVisibility($visibility);
}

return $this;
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use Magento\Directory\Helper\Data as DirectoryHelper;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Store\Api\StoreResolverInterface;
use Magento\Store\Model\StoreResolver;
use Magento\Framework\App\ObjectManager;

/**
Expand Down Expand Up @@ -51,15 +51,15 @@ class DirectoryDataProcessor implements \Magento\Checkout\Block\Checkout\LayoutP
/**
* @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollection
* @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollection
* @param StoreResolverInterface $storeResolver @deprecated
* @param StoreResolver $storeResolver @deprecated
* @param DirectoryHelper $directoryHelper
* @param StoreManagerInterface $storeManager
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(
\Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollection,
\Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollection,
StoreResolverInterface $storeResolver,
StoreResolver $storeResolver,
DirectoryHelper $directoryHelper,
StoreManagerInterface $storeManager = null
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Magento\Directory\Model\ResourceModel\Country\Collection;
use Magento\Directory\Model\ResourceModel\Country\CollectionFactory;
use Magento\Store\Api\Data\StoreInterface;
use Magento\Store\Api\StoreResolverInterface;
use Magento\Store\Model\StoreResolver;
use Magento\Store\Model\StoreManagerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -76,7 +76,7 @@ protected function setUp(): void
\Magento\Directory\Model\ResourceModel\Region\Collection::class
);
$this->storeResolverMock = $this->createMock(
StoreResolverInterface::class
StoreResolver::class
);
$this->directoryDataHelperMock = $this->createMock(Data::class);
$this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)
Expand Down

This file was deleted.

Loading