Skip to content

Commit

Permalink
Remove deprecated interfaces part 1 magento#32061
Browse files Browse the repository at this point in the history
  • Loading branch information
adamphh committed Feb 17, 2021
1 parent 517a568 commit 4766b88
Show file tree
Hide file tree
Showing 64 changed files with 63 additions and 1,115 deletions.
2 changes: 1 addition & 1 deletion 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 as QueryFactoryInterface;
use Magento\Search\Model\QueryInterface;
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;

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 as QueryFactoryInterface;
use Magento\Search\Model\QueryInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Magento\Eav\Model\Config;
use Magento\Framework\DB\Select;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Store\Api\StoreResolverInterface;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManagerInterface;

Expand All @@ -38,15 +37,13 @@ class StatusBaseSelectProcessor implements BaseSelectProcessorInterface
/**
* @param Config $eavConfig
* @param MetadataPool $metadataPool
* @param StoreResolverInterface $storeResolver
* @param StoreManagerInterface $storeManager
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(
Config $eavConfig,
MetadataPool $metadataPool,
StoreResolverInterface $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,7 @@ 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 +269,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 @@ -175,7 +167,6 @@ public function __construct(
SearchCriteriaResolverFactory $searchCriteriaResolverFactory = null,
SearchResultApplierFactory $searchResultApplierFactory = null,
TotalRecordsResolverFactory $totalRecordsResolverFactory = null,
DefaultFilterStrategyApplyCheckerInterface $defaultFilterStrategyApplyChecker = 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,6 @@

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

/**
Expand Down Expand Up @@ -51,15 +50,13 @@ 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 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,
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 as StoreResolverInterface;
use Magento\Store\Model\StoreManagerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand Down

This file was deleted.

4 changes: 1 addition & 3 deletions app/code/Magento/Elasticsearch/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<argument name="searchCriteriaResolverFactory" xsi:type="object">elasticsearchSearchCriteriaResolverFactory</argument>
<argument name="searchResultApplierFactory" xsi:type="object">elasticsearchSearchResultApplier\Factory</argument>
<argument name="totalRecordsResolverFactory" xsi:type="object">elasticsearchTotalRecordsResolver\Factory</argument>
<argument name="defaultFilterStrategyApplyChecker" xsi:type="object">Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\DefaultFilterStrategyApplyChecker</argument>

</arguments>
</virtualType>
<virtualType name="elasticsearchFulltextSearchCollectionFactory" type="Magento\CatalogSearch\Model\ResourceModel\Fulltext\SearchCollectionFactory">
Expand All @@ -75,7 +75,6 @@
<argument name="searchCriteriaResolverFactory" xsi:type="object">elasticsearchSearchCriteriaResolverFactory</argument>
<argument name="searchResultApplierFactory" xsi:type="object">elasticsearchSearchResultApplier\Factory</argument>
<argument name="totalRecordsResolverFactory" xsi:type="object">elasticsearchTotalRecordsResolver\Factory</argument>
<argument name="defaultFilterStrategyApplyChecker" xsi:type="object">Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\DefaultFilterStrategyApplyChecker</argument>
</arguments>
</virtualType>
<virtualType name="elasticsearchCategoryCollectionFactory" type="Magento\CatalogSearch\Model\ResourceModel\Fulltext\SearchCollectionFactory">
Expand All @@ -97,7 +96,6 @@
<argument name="searchCriteriaResolverFactory" xsi:type="object">elasticsearchSearchCriteriaResolverFactory</argument>
<argument name="searchResultApplierFactory" xsi:type="object">elasticsearchSearchResultApplier\Factory</argument>
<argument name="totalRecordsResolverFactory" xsi:type="object">elasticsearchTotalRecordsResolver\Factory</argument>
<argument name="defaultFilterStrategyApplyChecker" xsi:type="object">Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\DefaultFilterStrategyApplyChecker</argument>
</arguments>
</virtualType>
<virtualType name="elasticsearchAdvancedCollectionFactory" type="Magento\CatalogSearch\Model\ResourceModel\Advanced\CollectionFactory">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Magento\MediaContentApi\Model\SearchPatternConfigInterface;
use Magento\MediaContentApi\Api\ExtractAssetsFromContentInterface;
use Magento\MediaGalleryApi\Api\Data\AssetInterface;
use Magento\MediaGalleryApi\Model\Asset\Command\GetByPathInterface;
use Magento\MediaGalleryApi\Api\GetAssetsByPathsInterface as GetByPathInterface;
use Psr\Log\LoggerInterface;

/**
Expand Down Expand Up @@ -85,7 +85,7 @@ private function getAssetsByPaths(array $paths): array
$path = trim($path, '"\'');
try {
/** @var AssetInterface $asset */
$asset = $this->getMediaAssetByPath->execute($this->getPathStartingWithSlash($path));
$asset = $this->getMediaAssetByPath->execute([$this->getPathStartingWithSlash($path)]);
$assets[$asset->getId()] = $asset;
} catch (\Exception $exception) {
$this->logger->critical($exception);
Expand Down
Loading

0 comments on commit 4766b88

Please sign in to comment.