Skip to content

Commit

Permalink
🔃 [GraphQL] Partners Acceleration Program Contributions - 2.4-develop
Browse files Browse the repository at this point in the history
Accepted Community Pull Requests:
 - #28794: #28569:Multi-store: Missing store codes in relation t… (by @gallyamov)
 - #28904: #26107: Exception message on cart with no shipment items (by @michalderlatka)
 - #28747: #28579:DependencyTest does not analyze GraphQL schema… (by @sasha19957099)
 - #28757: 28563: GraphQL product search does not consider Category Permissions configuration - Pass the context as argument  (by @pmarjan)
 - #27882: Adding Product Reviews GraphQl support (by @eduard13)


Fixed GitHub Issues:
 - #28569: Multi-store: Missing store codes in relation to a group and website (reported by @magento-engcom-team) has been fixed in #28794 by @gallyamov in 2.4-develop branch
   Related commits:
     1. 0b577a3
     2. 1973c26
     3. 5ab033d
     4. ac5835b
     5. 5ea15d1
     6. 4fe5f8f
     7. 48f8add
     8. d8643e2
     9. 7cb5e98
     10. 2a3f775
     11. d627611
     12. 48749bc
     13. 362b81a
     14. 78ea7b8
     15. e1f8b56
     16. 4c994bf
     17. ad896c5
     18. 454695c
     19. 00fbf7f
     20. 3c770e2
     21. d9edb5b
     22. b23125e
     23. 0ccadf5

 - #26107: Customer got an error about Virtual Product after setting the shipping address on Cart that contains Downloadable Product only (reported by @TomashKhamlai) has been fixed in #28904 by @michalderlatka in 2.4-develop branch
   Related commits:
     1. 1091a30
     2. c8c4e06
     3. 77bd613

 - #28563: GraphQL product search does not consider Category Permissions configuration (reported by @magento-engcom-team) has been fixed in #28757 by @pmarjan in 2.4-develop branch
   Related commits:
     1. 308ef0e
     2. 332369d
     3. 966aeba
     4. 191b758
     5. a5e978e
     6. c535264
     7. ea0ea52
     8. 48f9256
     9. 4ed80e3
     10. d0f3415
     11. a675e30
     12. c689798
     13. d127628
     14. a87a88d

 - #250: Admin routing to 404 page after installation (reported by @tiagosampaio) has been fixed in #27882 by @eduard13 in 2.4-develop branch
   Related commits:
     1. 9365b57
     2. ddf7d53
     3. 51e2fbc
     4. 0564f78
     5. 1d75c53
     6. e21d3a8
     7. dd796f3
     8. 1b7bade
     9. 9b8912e
     10. 20dfcc6
     11. 5809bee
     12. 4fedd42
     13. 64f9f00
     14. 5a4b007
     15. 3592cf9
     16. 7089708
     17. 017da27
     18. a020625
     19. 0111b2d
     20. f168ca6
     21. f443741
     22. 11c7fd4
     23. c9184f6
     24. b974b48
     25. de8598c
     26. 9230db6
  • Loading branch information
magento-engcom-team authored Jul 15, 2020
2 parents 878b1c9 + e886fd1 commit 1d8a6d7
Show file tree
Hide file tree
Showing 71 changed files with 3,168 additions and 374 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function resolve(
'eq' => $value['id']
]
];
$searchResult = $this->searchQuery->getResult($args, $info);
$searchResult = $this->searchQuery->getResult($args, $info, $context);

//possible division by 0
if ($searchResult->getPageSize()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function resolve(
);
}

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

if ($searchResult->getCurrentPage() > $searchResult->getTotalPages() && $searchResult->getTotalCount() > 0) {
throw new GraphQlInputException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product as ProductDataProvider;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\GraphQl\Model\Query\ContextInterface;

/**
* Deferred resolver for product data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory;
use Magento\Framework\Api\SearchResultsInterface;
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
use Magento\GraphQl\Model\Query\ContextInterface;

/**
* Product field data provider, used for GraphQL resolver processing.
Expand Down Expand Up @@ -73,18 +74,20 @@ public function __construct(
* @param string[] $attributes
* @param bool $isSearch
* @param bool $isChildSearch
* @param ContextInterface|null $context
* @return SearchResultsInterface
*/
public function getList(
SearchCriteriaInterface $searchCriteria,
array $attributes = [],
bool $isSearch = false,
bool $isChildSearch = false
bool $isChildSearch = false,
ContextInterface $context = null
): SearchResultsInterface {
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $collection */
$collection = $this->collectionFactory->create();

$this->collectionPreProcessor->process($collection, $searchCriteria, $attributes);
$this->collectionPreProcessor->process($collection, $searchCriteria, $attributes, $context);

if (!$isChildSearch) {
$visibilityIds = $isSearch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\GraphQl\Model\Query\ContextInterface;

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

/**
* @inheritdoc
* Process collection to add additional joins, attributes, and clauses to a product collection.
*
* @param Collection $collection
* @param SearchCriteriaInterface $searchCriteria
* @param array $attributeNames
* @param ContextInterface|null $context
* @return Collection
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function process(
Collection $collection,
SearchCriteriaInterface $searchCriteria,
array $attributeNames
array $attributeNames,
ContextInterface $context = null
): Collection {
foreach ($attributeNames as $name) {
$this->addAttribute($collection, $name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
use Magento\GraphQl\Model\Query\ContextInterface;

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

/**
* Process collection to add additional joins, attributes, and clauses to a product collection.
*
* @param Collection $collection
* @param SearchCriteriaInterface $searchCriteria
* @param array $attributeNames
* @param ContextInterface|null $context
* @return Collection
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function process(
Collection $collection,
SearchCriteriaInterface $searchCriteria,
array $attributeNames
array $attributeNames,
ContextInterface $context = null
): Collection {
$this->joinProcessor->process($collection);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Catalog\Model\Product\Media\Config as MediaConfig;
use Magento\GraphQl\Model\Query\ContextInterface;

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

/**
* @inheritdoc
* Process collection to add additional joins, attributes, and clauses to a product collection.
*
* @param Collection $collection
* @param SearchCriteriaInterface $searchCriteria
* @param array $attributeNames
* @param ContextInterface|null $context
* @return Collection
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function process(
Collection $collection,
SearchCriteriaInterface $searchCriteria,
array $attributeNames
array $attributeNames,
ContextInterface $context = null
): Collection {
if (in_array('media_gallery_entries', $attributeNames)) {
$mediaAttributes = $this->mediaConfig->getMediaAttributeCodes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\GraphQl\Model\Query\ContextInterface;

/**
* Add attributes required for every GraphQL product resolution process.
Expand All @@ -19,12 +20,20 @@
class RequiredColumnsProcessor implements CollectionProcessorInterface
{
/**
* {@inheritdoc}
* Process collection to add additional joins, attributes, and clauses to a product collection.
*
* @param Collection $collection
* @param SearchCriteriaInterface $searchCriteria
* @param array $attributeNames
* @param ContextInterface|null $context
* @return Collection
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function process(
Collection $collection,
SearchCriteriaInterface $searchCriteria,
array $attributeNames
array $attributeNames,
ContextInterface $context = null
): Collection {
$collection->addAttributeToSelect('special_price');
$collection->addAttributeToSelect('special_price_from');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface as SearchCriteriaApplier;
use Magento\GraphQl\Model\Query\ContextInterface;

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

/**
* {@inheritdoc}
* Process collection to add additional joins, attributes, and clauses to a product collection.
*
* @param Collection $collection
* @param SearchCriteriaInterface $searchCriteria
* @param array $attributeNames
* @param ContextInterface|null $context
* @return Collection
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function process(
Collection $collection,
SearchCriteriaInterface $searchCriteria,
array $attributeNames
array $attributeNames,
ContextInterface $context = null
): Collection {
$this->searchCriteriaApplier->process($searchCriteria, $collection);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\CatalogInventory\Api\StockConfigurationInterface;
use Magento\CatalogInventory\Model\ResourceModel\Stock\Status as StockStatusResource;
use Magento\GraphQl\Model\Query\ContextInterface;

/**
* Add stock filtering if configuration requires it.
Expand Down Expand Up @@ -41,12 +42,20 @@ public function __construct(StockConfigurationInterface $stockConfig, StockStatu
}

/**
* {@inheritdoc}
* Process collection to add additional joins, attributes, and clauses to a product collection.
*
* @param Collection $collection
* @param SearchCriteriaInterface $searchCriteria
* @param array $attributeNames
* @param ContextInterface|null $context
* @return Collection
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function process(
Collection $collection,
SearchCriteriaInterface $searchCriteria,
array $attributeNames
array $attributeNames,
ContextInterface $context = null
): Collection {
if (!$this->stockConfig->isShowOutOfStock()) {
$this->stockStatusResource->addIsInStockFilterToCollection($collection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\GraphQl\Model\Query\ContextInterface;

/**
* Join visibility and status tables to product collection
Expand All @@ -19,12 +20,20 @@
class VisibilityStatusProcessor implements CollectionProcessorInterface
{
/**
* {@inheritdoc}
* Process collection to add additional joins, attributes, and clauses to a product collection.
*
* @param Collection $collection
* @param SearchCriteriaInterface $searchCriteria
* @param array $attributeNames
* @param ContextInterface|null $context
* @return Collection
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function process(
Collection $collection,
SearchCriteriaInterface $searchCriteria,
array $attributeNames
array $attributeNames,
ContextInterface $context = null
): Collection {
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\GraphQl\Model\Query\ContextInterface;

/**
* Add additional joins, attributes, and clauses to a product collection.
Expand All @@ -21,11 +22,13 @@ interface CollectionProcessorInterface
* @param Collection $collection
* @param SearchCriteriaInterface $searchCriteria
* @param array $attributeNames
* @param ContextInterface|null $context
* @return Collection
*/
public function process(
Collection $collection,
SearchCriteriaInterface $searchCriteria,
array $attributeNames
array $attributeNames,
ContextInterface $context = null
): Collection;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\GraphQl\Model\Query\ContextInterface;

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

/**
* {@inheritdoc}
* Process collection to add additional joins, attributes, and clauses to a product collection.
*
* @param Collection $collection
* @param SearchCriteriaInterface $searchCriteria
* @param array $attributeNames
* @param ContextInterface|null $context
* @return Collection
*/
public function process(
Collection $collection,
SearchCriteriaInterface $searchCriteria,
array $attributeNames
array $attributeNames,
ContextInterface $context = null
): Collection {
foreach ($this->collectionProcessors as $collectionProcessor) {
$collection = $collectionProcessor->process($collection, $searchCriteria, $attributeNames);
$collection = $collectionProcessor->process($collection, $searchCriteria, $attributeNames, $context);
}

return $collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Magento\Framework\Api\Search\SearchResultInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Api\SearchResultsInterface;
use Magento\GraphQl\Model\Query\ContextInterface;

/**
* Product field data provider for product search, used for GraphQL resolver processing.
Expand Down Expand Up @@ -84,12 +85,14 @@ public function __construct(
* @param SearchCriteriaInterface $searchCriteria
* @param SearchResultInterface $searchResult
* @param array $attributes
* @param ContextInterface|null $context
* @return SearchResultsInterface
*/
public function getList(
SearchCriteriaInterface $searchCriteria,
SearchResultInterface $searchResult,
array $attributes = []
array $attributes = [],
ContextInterface $context = null
): SearchResultsInterface {
/** @var Collection $collection */
$collection = $this->collectionFactory->create();
Expand All @@ -103,7 +106,7 @@ public function getList(
$this->getSortOrderArray($searchCriteriaForCollection)
)->apply();

$this->collectionPreProcessor->process($collection, $searchCriteriaForCollection, $attributes);
$this->collectionPreProcessor->process($collection, $searchCriteriaForCollection, $attributes, $context);
$collection->load();
$this->collectionPostProcessor->process($collection, $attributes);

Expand Down
Loading

0 comments on commit 1d8a6d7

Please sign in to comment.