Skip to content

Commit 9009663

Browse files
authored
Merge branch '2.4-develop' into AdminSystemStorePage-url
2 parents 968f93b + 1d8a6d7 commit 9009663

File tree

71 files changed

+3168
-374
lines changed

Some content is hidden

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

71 files changed

+3168
-374
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Category/Products.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function resolve(
6363
'eq' => $value['id']
6464
]
6565
];
66-
$searchResult = $this->searchQuery->getResult($args, $info);
66+
$searchResult = $this->searchQuery->getResult($args, $info, $context);
6767

6868
//possible division by 0
6969
if ($searchResult->getPageSize()) {

app/code/Magento/CatalogGraphQl/Model/Resolver/Products.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function resolve(
6969
);
7070
}
7171

72-
$searchResult = $this->searchQuery->getResult($args, $info);
72+
$searchResult = $this->searchQuery->getResult($args, $info, $context);
7373

7474
if ($searchResult->getCurrentPage() > $searchResult->getTotalPages() && $searchResult->getTotalCount() > 0) {
7575
throw new GraphQlInputException(

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Deferred/Product.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Catalog\Api\Data\ProductInterface;
1111
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product as ProductDataProvider;
1212
use Magento\Framework\Api\SearchCriteriaBuilder;
13+
use Magento\GraphQl\Model\Query\ContextInterface;
1314

1415
/**
1516
* Deferred resolver for product data.

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory;
1515
use Magento\Framework\Api\SearchResultsInterface;
1616
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
17+
use Magento\GraphQl\Model\Query\ContextInterface;
1718

1819
/**
1920
* Product field data provider, used for GraphQL resolver processing.
@@ -73,18 +74,20 @@ public function __construct(
7374
* @param string[] $attributes
7475
* @param bool $isSearch
7576
* @param bool $isChildSearch
77+
* @param ContextInterface|null $context
7678
* @return SearchResultsInterface
7779
*/
7880
public function getList(
7981
SearchCriteriaInterface $searchCriteria,
8082
array $attributes = [],
8183
bool $isSearch = false,
82-
bool $isChildSearch = false
84+
bool $isChildSearch = false,
85+
ContextInterface $context = null
8386
): SearchResultsInterface {
8487
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $collection */
8588
$collection = $this->collectionFactory->create();
8689

87-
$this->collectionPreProcessor->process($collection, $searchCriteria, $attributes);
90+
$this->collectionPreProcessor->process($collection, $searchCriteria, $attributes, $context);
8891

8992
if (!$isChildSearch) {
9093
$visibilityIds = $isSearch

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/AttributeProcessor.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Catalog\Model\ResourceModel\Product\Collection;
1111
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
1212
use Magento\Framework\Api\SearchCriteriaInterface;
13+
use Magento\GraphQl\Model\Query\ContextInterface;
1314

1415
/**
1516
* Adds passed in attributes to product collection results
@@ -34,12 +35,20 @@ public function __construct($fieldToAttributeMap = [])
3435
}
3536

3637
/**
37-
* @inheritdoc
38+
* Process collection to add additional joins, attributes, and clauses to a product collection.
39+
*
40+
* @param Collection $collection
41+
* @param SearchCriteriaInterface $searchCriteria
42+
* @param array $attributeNames
43+
* @param ContextInterface|null $context
44+
* @return Collection
45+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3846
*/
3947
public function process(
4048
Collection $collection,
4149
SearchCriteriaInterface $searchCriteria,
42-
array $attributeNames
50+
array $attributeNames,
51+
ContextInterface $context = null
4352
): Collection {
4453
foreach ($attributeNames as $name) {
4554
$this->addAttribute($collection, $name);

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/ExtensibleEntityProcessor.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
1212
use Magento\Framework\Api\SearchCriteriaInterface;
1313
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
14+
use Magento\GraphQl\Model\Query\ContextInterface;
1415

1516
/**
1617
* Add necessary joins for extensible entities.
@@ -33,16 +34,20 @@ public function __construct(JoinProcessorInterface $joinProcessor)
3334
}
3435

3536
/**
37+
* Process collection to add additional joins, attributes, and clauses to a product collection.
38+
*
3639
* @param Collection $collection
3740
* @param SearchCriteriaInterface $searchCriteria
3841
* @param array $attributeNames
42+
* @param ContextInterface|null $context
3943
* @return Collection
4044
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4145
*/
4246
public function process(
4347
Collection $collection,
4448
SearchCriteriaInterface $searchCriteria,
45-
array $attributeNames
49+
array $attributeNames,
50+
ContextInterface $context = null
4651
): Collection {
4752
$this->joinProcessor->process($collection);
4853

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/MediaGalleryProcessor.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
1212
use Magento\Framework\Api\SearchCriteriaInterface;
1313
use Magento\Catalog\Model\Product\Media\Config as MediaConfig;
14+
use Magento\GraphQl\Model\Query\ContextInterface;
1415

1516
/**
1617
* Add attributes required for every GraphQL product resolution process.
@@ -35,12 +36,20 @@ public function __construct(MediaConfig $mediaConfig)
3536
}
3637

3738
/**
38-
* @inheritdoc
39+
* Process collection to add additional joins, attributes, and clauses to a product collection.
40+
*
41+
* @param Collection $collection
42+
* @param SearchCriteriaInterface $searchCriteria
43+
* @param array $attributeNames
44+
* @param ContextInterface|null $context
45+
* @return Collection
46+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3947
*/
4048
public function process(
4149
Collection $collection,
4250
SearchCriteriaInterface $searchCriteria,
43-
array $attributeNames
51+
array $attributeNames,
52+
ContextInterface $context = null
4453
): Collection {
4554
if (in_array('media_gallery_entries', $attributeNames)) {
4655
$mediaAttributes = $this->mediaConfig->getMediaAttributeCodes();

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/RequiredColumnsProcessor.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Catalog\Model\ResourceModel\Product\Collection;
1111
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
1212
use Magento\Framework\Api\SearchCriteriaInterface;
13+
use Magento\GraphQl\Model\Query\ContextInterface;
1314

1415
/**
1516
* Add attributes required for every GraphQL product resolution process.
@@ -19,12 +20,20 @@
1920
class RequiredColumnsProcessor implements CollectionProcessorInterface
2021
{
2122
/**
22-
* {@inheritdoc}
23+
* Process collection to add additional joins, attributes, and clauses to a product collection.
24+
*
25+
* @param Collection $collection
26+
* @param SearchCriteriaInterface $searchCriteria
27+
* @param array $attributeNames
28+
* @param ContextInterface|null $context
29+
* @return Collection
30+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2331
*/
2432
public function process(
2533
Collection $collection,
2634
SearchCriteriaInterface $searchCriteria,
27-
array $attributeNames
35+
array $attributeNames,
36+
ContextInterface $context = null
2837
): Collection {
2938
$collection->addAttributeToSelect('special_price');
3039
$collection->addAttributeToSelect('special_price_from');

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/SearchCriteriaProcessor.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
1212
use Magento\Framework\Api\SearchCriteriaInterface;
1313
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface as SearchCriteriaApplier;
14+
use Magento\GraphQl\Model\Query\ContextInterface;
1415

1516
/**
1617
* Apply search criteria data to passed in collection.
@@ -33,12 +34,20 @@ public function __construct(SearchCriteriaApplier $searchCriteriaApplier)
3334
}
3435

3536
/**
36-
* {@inheritdoc}
37+
* Process collection to add additional joins, attributes, and clauses to a product collection.
38+
*
39+
* @param Collection $collection
40+
* @param SearchCriteriaInterface $searchCriteria
41+
* @param array $attributeNames
42+
* @param ContextInterface|null $context
43+
* @return Collection
44+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3745
*/
3846
public function process(
3947
Collection $collection,
4048
SearchCriteriaInterface $searchCriteria,
41-
array $attributeNames
49+
array $attributeNames,
50+
ContextInterface $context = null
4251
): Collection {
4352
$this->searchCriteriaApplier->process($searchCriteria, $collection);
4453

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/StockProcessor.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\Api\SearchCriteriaInterface;
1313
use Magento\CatalogInventory\Api\StockConfigurationInterface;
1414
use Magento\CatalogInventory\Model\ResourceModel\Stock\Status as StockStatusResource;
15+
use Magento\GraphQl\Model\Query\ContextInterface;
1516

1617
/**
1718
* Add stock filtering if configuration requires it.
@@ -41,12 +42,20 @@ public function __construct(StockConfigurationInterface $stockConfig, StockStatu
4142
}
4243

4344
/**
44-
* {@inheritdoc}
45+
* Process collection to add additional joins, attributes, and clauses to a product collection.
46+
*
47+
* @param Collection $collection
48+
* @param SearchCriteriaInterface $searchCriteria
49+
* @param array $attributeNames
50+
* @param ContextInterface|null $context
51+
* @return Collection
52+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4553
*/
4654
public function process(
4755
Collection $collection,
4856
SearchCriteriaInterface $searchCriteria,
49-
array $attributeNames
57+
array $attributeNames,
58+
ContextInterface $context = null
5059
): Collection {
5160
if (!$this->stockConfig->isShowOutOfStock()) {
5261
$this->stockStatusResource->addIsInStockFilterToCollection($collection);

0 commit comments

Comments
 (0)