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);

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/VisibilityStatusProcessor.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
* Join visibility and status tables to product collection
@@ -19,12 +20,20 @@
1920
class VisibilityStatusProcessor 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->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
3039
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Catalog\Model\ResourceModel\Product\Collection;
1111
use Magento\Framework\Api\SearchCriteriaInterface;
12+
use Magento\GraphQl\Model\Query\ContextInterface;
1213

1314
/**
1415
* Add additional joins, attributes, and clauses to a product collection.
@@ -21,11 +22,13 @@ interface CollectionProcessorInterface
2122
* @param Collection $collection
2223
* @param SearchCriteriaInterface $searchCriteria
2324
* @param array $attributeNames
25+
* @param ContextInterface|null $context
2426
* @return Collection
2527
*/
2628
public function process(
2729
Collection $collection,
2830
SearchCriteriaInterface $searchCriteria,
29-
array $attributeNames
31+
array $attributeNames,
32+
ContextInterface $context = null
3033
): Collection;
3134
}

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Catalog\Model\ResourceModel\Product\Collection;
1111
use Magento\Framework\Api\SearchCriteriaInterface;
12+
use Magento\GraphQl\Model\Query\ContextInterface;
1213

1314
/**
1415
* {@inheritdoc}
@@ -29,15 +30,22 @@ public function __construct(array $collectionProcessors = [])
2930
}
3031

3132
/**
32-
* {@inheritdoc}
33+
* Process collection to add additional joins, attributes, and clauses to a product collection.
34+
*
35+
* @param Collection $collection
36+
* @param SearchCriteriaInterface $searchCriteria
37+
* @param array $attributeNames
38+
* @param ContextInterface|null $context
39+
* @return Collection
3340
*/
3441
public function process(
3542
Collection $collection,
3643
SearchCriteriaInterface $searchCriteria,
37-
array $attributeNames
44+
array $attributeNames,
45+
ContextInterface $context = null
3846
): Collection {
3947
foreach ($this->collectionProcessors as $collectionProcessor) {
40-
$collection = $collectionProcessor->process($collection, $searchCriteria, $attributeNames);
48+
$collection = $collectionProcessor->process($collection, $searchCriteria, $attributeNames, $context);
4149
}
4250

4351
return $collection;

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Magento\Framework\Api\Search\SearchResultInterface;
1919
use Magento\Framework\Api\SearchCriteriaInterface;
2020
use Magento\Framework\Api\SearchResultsInterface;
21+
use Magento\GraphQl\Model\Query\ContextInterface;
2122

2223
/**
2324
* Product field data provider for product search, used for GraphQL resolver processing.
@@ -84,12 +85,14 @@ public function __construct(
8485
* @param SearchCriteriaInterface $searchCriteria
8586
* @param SearchResultInterface $searchResult
8687
* @param array $attributes
88+
* @param ContextInterface|null $context
8789
* @return SearchResultsInterface
8890
*/
8991
public function getList(
9092
SearchCriteriaInterface $searchCriteria,
9193
SearchResultInterface $searchResult,
92-
array $attributes = []
94+
array $attributes = [],
95+
ContextInterface $context = null
9396
): SearchResultsInterface {
9497
/** @var Collection $collection */
9598
$collection = $this->collectionFactory->create();
@@ -103,7 +106,7 @@ public function getList(
103106
$this->getSortOrderArray($searchCriteriaForCollection)
104107
)->apply();
105108

106-
$this->collectionPreProcessor->process($collection, $searchCriteriaForCollection, $attributes);
109+
$this->collectionPreProcessor->process($collection, $searchCriteriaForCollection, $attributes, $context);
107110
$collection->load();
108111
$this->collectionPostProcessor->process($collection, $attributes);
109112

0 commit comments

Comments
 (0)