Skip to content

Commit 694dda4

Browse files
committed
Merge branch '2.3-develop' into graphql-961
2 parents 18784c2 + 419fbf3 commit 694dda4

File tree

210 files changed

+4512
-1766
lines changed

Some content is hidden

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

210 files changed

+4512
-1766
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\AsynchronousOperations\Model;
9+
10+
use Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterface;
11+
use Magento\Framework\Api\SearchResults;
12+
13+
/**
14+
* Service Data Object with bulk Operation search result.
15+
*/
16+
class OperationSearchResults extends SearchResults implements OperationSearchResultsInterface
17+
{
18+
}

app/code/Magento/AsynchronousOperations/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<preference for="Magento\AsynchronousOperations\Api\Data\SummaryOperationStatusInterface" type="Magento\AsynchronousOperations\Model\OperationStatus" />
1717
<preference for="Magento\AsynchronousOperations\Api\Data\DetailedBulkOperationsStatusInterface" type="Magento\AsynchronousOperations\Model\BulkStatus\Detailed" />
1818
<preference for="Magento\AsynchronousOperations\Api\Data\BulkOperationsStatusInterface" type="Magento\AsynchronousOperations\Model\BulkStatus\Short" />
19-
<preference for="Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterface" type="Magento\Framework\Api\SearchResults" />
19+
<preference for="Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterface" type="Magento\AsynchronousOperations\Model\OperationSearchResults" />
2020
<preference for="Magento\AsynchronousOperations\Api\OperationRepositoryInterface" type="Magento\AsynchronousOperations\Model\OperationRepository" />
2121
<type name="Magento\Framework\EntityManager\MetadataPool">
2222
<arguments>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\BundleGraphQl\Model\Resolver\Product\Price;
9+
10+
use Magento\Bundle\Pricing\Price\FinalPrice;
11+
use Magento\Catalog\Pricing\Price\BasePrice;
12+
use Magento\Bundle\Model\Product\Price;
13+
use Magento\Catalog\Pricing\Price\RegularPrice;
14+
use Magento\CatalogGraphQl\Model\Resolver\Product\Price\ProviderInterface;
15+
use Magento\Framework\Pricing\Amount\AmountInterface;
16+
use Magento\Framework\Pricing\SaleableInterface;
17+
18+
/**
19+
* Provides pricing information for Bundle products
20+
*/
21+
class Provider implements ProviderInterface
22+
{
23+
/**
24+
* @inheritdoc
25+
*/
26+
public function getMinimalFinalPrice(SaleableInterface $product): AmountInterface
27+
{
28+
return $product->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getMinimalPrice();
29+
}
30+
31+
/**
32+
* @inheritdoc
33+
*/
34+
public function getMinimalRegularPrice(SaleableInterface $product): AmountInterface
35+
{
36+
return $product->getPriceInfo()->getPrice(RegularPrice::PRICE_CODE)->getMinimalPrice();
37+
}
38+
39+
/**
40+
* @inheritdoc
41+
*/
42+
public function getMaximalFinalPrice(SaleableInterface $product): AmountInterface
43+
{
44+
return $product->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getMaximalPrice();
45+
}
46+
47+
/**
48+
* @inheritdoc
49+
*/
50+
public function getMaximalRegularPrice(SaleableInterface $product): AmountInterface
51+
{
52+
return $product->getPriceInfo()->getPrice(RegularPrice::PRICE_CODE)->getMaximalPrice();
53+
}
54+
55+
/**
56+
* @inheritdoc
57+
*/
58+
public function getRegularPrice(SaleableInterface $product): AmountInterface
59+
{
60+
if ($product->getPriceType() == Price::PRICE_TYPE_FIXED) {
61+
return $product->getPriceInfo()->getPrice(BasePrice::PRICE_CODE)->getAmount();
62+
}
63+
return $product->getPriceInfo()->getPrice(RegularPrice::PRICE_CODE)->getAmount();
64+
}
65+
}

app/code/Magento/BundleGraphQl/etc/graphql/di.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,22 @@
4040
</argument>
4141
</arguments>
4242
</type>
43+
44+
45+
<type name="Magento\CatalogGraphQl\Model\Resolver\Product\Price\ProviderPool">
46+
<arguments>
47+
<argument name="providers" xsi:type="array">
48+
<item name="bundle" xsi:type="object">Magento\BundleGraphQl\Model\Resolver\Product\Price\Provider</item>
49+
</argument>
50+
</arguments>
51+
</type>
52+
<type name="Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product\CollectionProcessor\AttributeProcessor">
53+
<arguments>
54+
<argument name="fieldToAttributeMap" xsi:type="array">
55+
<item name="price_range" xsi:type="array">
56+
<item name="price_type" xsi:type="string">price_type</item>
57+
</item>
58+
</argument>
59+
</arguments>
60+
</type>
4361
</config>

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilter.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\CatalogInventory\Api\StockConfigurationInterface;
99
use Magento\Framework\App\Config\ScopeConfigInterface;
10-
use Magento\CatalogInventory\Model\Stock;
1110

1211
/**
1312
* Class StockDataFilter
@@ -61,8 +60,8 @@ public function filter(array $stockData)
6160
$stockData['qty'] = self::MAX_QTY_VALUE;
6261
}
6362

64-
if (isset($stockData['min_qty'])) {
65-
$stockData['min_qty'] = $this->purifyMinQty($stockData['min_qty'], $stockData['backorders']);
63+
if (isset($stockData['min_qty']) && (int)$stockData['min_qty'] < 0) {
64+
$stockData['min_qty'] = 0;
6665
}
6766

6867
if (!isset($stockData['is_decimal_divided']) || $stockData['is_qty_decimal'] == 0) {
@@ -71,27 +70,4 @@ public function filter(array $stockData)
7170

7271
return $stockData;
7372
}
74-
75-
/**
76-
* Purifies min_qty.
77-
*
78-
* @param int $minQty
79-
* @param int $backOrders
80-
* @return float
81-
*/
82-
private function purifyMinQty(int $minQty, int $backOrders): float
83-
{
84-
/**
85-
* As described in the documentation if the Backorders Option is disabled
86-
* it is recommended to set the Out Of Stock Threshold to a positive number.
87-
* That's why to clarify the logic to the end user the code below prevent him to set a negative number so such
88-
* a number will turn to zero.
89-
* @see https://docs.magento.com/m2/ce/user_guide/catalog/inventory-backorders.html
90-
*/
91-
if ($backOrders === Stock::BACKORDERS_NO && $minQty < 0) {
92-
$minQty = 0;
93-
}
94-
95-
return (float)$minQty;
96-
}
9773
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model;
9+
10+
use Magento\Catalog\Api\Data\CategoryAttributeSearchResultsInterface;
11+
use Magento\Framework\Api\SearchResults;
12+
13+
/**
14+
* Service Data Object with Category Attribute search results.
15+
*/
16+
class CategoryAttributeSearchResults extends SearchResults implements CategoryAttributeSearchResultsInterface
17+
{
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model;
9+
10+
use Magento\Catalog\Api\Data\CategorySearchResultsInterface;
11+
use Magento\Framework\Api\SearchResults;
12+
13+
/**
14+
* Service Data Object with Category search results.
15+
*/
16+
class CategorySearchResults extends SearchResults implements CategorySearchResultsInterface
17+
{
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model;
9+
10+
use Magento\Catalog\Api\Data\ProductAttributeSearchResultsInterface;
11+
use Magento\Framework\Api\SearchResults;
12+
13+
/**
14+
* Service Data Object with Product Attribute search results.
15+
*/
16+
class ProductAttributeSearchResults extends SearchResults implements ProductAttributeSearchResultsInterface
17+
{
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model;
9+
10+
use Magento\Catalog\Api\Data\ProductSearchResultsInterface;
11+
use Magento\Framework\Api\SearchResults;
12+
13+
/**
14+
* Service Data Object with Product search results.
15+
*/
16+
class ProductSearchResults extends SearchResults implements ProductSearchResultsInterface
17+
{
18+
}

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/Source.php

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus;
99
use Magento\Catalog\Api\Data\ProductInterface;
1010
use Magento\Catalog\Api\Data\ProductAttributeInterface;
11+
use Magento\Framework\DB\Select;
12+
use Magento\Framework\DB\Sql\UnionExpression;
1113

1214
/**
1315
* Catalog Product Eav Select and Multiply Select Attributes Indexer resource model
@@ -199,13 +201,52 @@ protected function _prepareSelectIndex($entityIds = null, $attributeId = null)
199201
'dd.attribute_id',
200202
's.store_id',
201203
'value' => new \Zend_Db_Expr('COALESCE(ds.value, dd.value)'),
202-
'cpe.entity_id',
204+
'cpe.entity_id AS source_id',
203205
]
204206
);
205207

206208
if ($entityIds !== null) {
207209
$ids = implode(',', array_map('intval', $entityIds));
210+
$selectWithoutDefaultStore = $connection->select()->from(
211+
['wd' => $this->getTable('catalog_product_entity_int')],
212+
[
213+
'cpe.entity_id',
214+
'attribute_id',
215+
'store_id',
216+
'value',
217+
'cpe.entity_id',
218+
]
219+
)->joinLeft(
220+
['cpe' => $this->getTable('catalog_product_entity')],
221+
"cpe.{$productIdField} = wd.{$productIdField}",
222+
[]
223+
)->joinLeft(
224+
['d2d' => $this->getTable('catalog_product_entity_int')],
225+
sprintf(
226+
"d2d.store_id = 0 AND d2d.{$productIdField} = wd.{$productIdField} AND d2d.attribute_id = %s",
227+
$this->_eavConfig->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'status')->getId()
228+
),
229+
[]
230+
)->joinLeft(
231+
['d2s' => $this->getTable('catalog_product_entity_int')],
232+
"d2s.store_id != 0 AND d2s.attribute_id = d2d.attribute_id AND " .
233+
"d2s.{$productIdField} = d2d.{$productIdField}",
234+
[]
235+
)
236+
->where((new \Zend_Db_Expr('COALESCE(d2s.value, d2d.value)')) . ' = ' . ProductStatus::STATUS_ENABLED)
237+
->where("wd.attribute_id IN({$attrIdsFlat})")
238+
->where('wd.value IS NOT NULL')
239+
->where('wd.store_id != 0')
240+
->where("cpe.entity_id IN({$ids})");
208241
$select->where("cpe.entity_id IN({$ids})");
242+
$selects = new UnionExpression(
243+
[$select, $selectWithoutDefaultStore],
244+
Select::SQL_UNION,
245+
'( %s )'
246+
);
247+
248+
$select = $connection->select();
249+
$select->from(['u' => $selects]);
209250
}
210251

211252
/**
@@ -342,7 +383,7 @@ private function getMultiSelectAttributeWithSourceModels($attrIds)
342383
ProductAttributeInterface::ENTITY_TYPE_CODE,
343384
$criteria
344385
)->getItems();
345-
386+
346387
$options = [];
347388
foreach ($attributes as $attribute) {
348389
$sourceModelOptions = $attribute->getOptions();

0 commit comments

Comments
 (0)