Skip to content

Commit 5fb4d1e

Browse files
authored
Merge branch '2.4-develop' into 137_Add_Company_to_Customers_Now_Online_grid
2 parents ae9bace + 2841088 commit 5fb4d1e

File tree

96 files changed

+3623
-133
lines changed

Some content is hidden

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

96 files changed

+3623
-133
lines changed

app/code/Magento/AsynchronousOperations/Model/MassConsumer.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,19 @@ public function process($maxNumberOfMessages = null)
6969
$this->registry->register('isSecureArea', true, true);
7070

7171
$queue = $this->configuration->getQueue();
72+
$maxIdleTime = $this->configuration->getMaxIdleTime();
73+
$sleep = $this->configuration->getSleep();
7274

7375
if (!isset($maxNumberOfMessages)) {
7476
$queue->subscribe($this->getTransactionCallback($queue));
7577
} else {
76-
$this->invoker->invoke($queue, $maxNumberOfMessages, $this->getTransactionCallback($queue));
78+
$this->invoker->invoke(
79+
$queue,
80+
$maxNumberOfMessages,
81+
$this->getTransactionCallback($queue),
82+
$maxIdleTime,
83+
$sleep
84+
);
7785
}
7886

7987
$this->registry->unregister('isSecureArea');
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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\Options;
9+
10+
use Magento\Framework\GraphQl\Config\Element\Field;
11+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
12+
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
13+
use Magento\Framework\GraphQl\Query\ResolverInterface;
14+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
15+
16+
/**
17+
* Format new option uid in base64 encode for entered bundle options
18+
*/
19+
class BundleItemOptionUid implements ResolverInterface
20+
{
21+
/**
22+
* Option type name
23+
*/
24+
private const OPTION_TYPE = 'bundle';
25+
26+
/**
27+
* Create a option uid for entered option in "<option-type>/<option-id>/<option-value-id>/<quantity>" format
28+
*
29+
* @param Field $field
30+
* @param ContextInterface $context
31+
* @param ResolveInfo $info
32+
* @param array|null $value
33+
* @param array|null $args
34+
*
35+
* @return string
36+
*
37+
* @throws GraphQlInputException
38+
*
39+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
40+
*/
41+
public function resolve(
42+
Field $field,
43+
$context,
44+
ResolveInfo $info,
45+
array $value = null,
46+
array $args = null
47+
) {
48+
if (!isset($value['option_id']) || empty($value['option_id'])) {
49+
throw new GraphQlInputException(__('"option_id" value should be specified.'));
50+
}
51+
52+
if (!isset($value['selection_id']) || empty($value['selection_id'])) {
53+
throw new GraphQlInputException(__('"selection_id" value should be specified.'));
54+
}
55+
56+
$optionDetails = [
57+
self::OPTION_TYPE,
58+
$value['option_id'],
59+
$value['selection_id'],
60+
(int) $value['selection_qty']
61+
];
62+
63+
$content = implode('/', $optionDetails);
64+
65+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
66+
return base64_encode($content);
67+
}
68+
}

app/code/Magento/BundleGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ type BundleItemOption @doc(description: "BundleItemOption defines characteristic
6666
price_type: PriceTypeEnum @doc(description: "One of FIXED, PERCENT, or DYNAMIC.")
6767
can_change_quantity: Boolean @doc(description: "Indicates whether the customer can change the number of items for this option.")
6868
product: ProductInterface @doc(description: "Contains details about this product option.") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product")
69+
uid: ID! @doc(description: "A string that encodes option details.") @resolver(class: "Magento\\BundleGraphQl\\Model\\Resolver\\Options\\BundleItemOptionUid") # A Base64 string that encodes option details.
6970
}
7071

7172
type BundleProduct implements ProductInterface, PhysicalProductInterface, CustomizableProductInterface @doc(description: "BundleProduct defines basic features of a bundle product and contains multiple BundleItems.") {

app/code/Magento/Catalog/Model/Category.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements
8787
*
8888
* @var string
8989
*/
90-
protected $_cacheTag = self::CACHE_TAG;
90+
protected $_cacheTag = false;
9191

9292
/**
9393
* URL Model instance
@@ -1111,6 +1111,17 @@ public function afterSave()
11111111
return $result;
11121112
}
11131113

1114+
/**
1115+
* @inheritDoc
1116+
*/
1117+
public function getCacheTags()
1118+
{
1119+
$identities = $this->getIdentities();
1120+
$cacheTags = !empty($identities) ? (array) $identities : parent::getCacheTags();
1121+
1122+
return $cacheTags;
1123+
}
1124+
11141125
/**
11151126
* Init indexing process after category save
11161127
*

app/code/Magento/Catalog/Model/Product.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\Catalog\Api\ProductLinkRepositoryInterface;
1212
use Magento\Catalog\Model\Product\Attribute\Backend\Media\EntryConverterPool;
1313
use Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface;
14-
use Magento\Catalog\Model\FilterProductCustomAttribute;
1514
use Magento\Framework\Api\AttributeValueFactory;
1615
use Magento\Framework\App\Filesystem\DirectoryList;
1716
use Magento\Framework\App\ObjectManager;
@@ -977,6 +976,17 @@ public function afterSave()
977976
return $result;
978977
}
979978

979+
/**
980+
* @inheritDoc
981+
*/
982+
public function getCacheTags()
983+
{
984+
$identities = $this->getIdentities();
985+
$cacheTags = !empty($identities) ? (array) $identities : parent::getCacheTags();
986+
987+
return $cacheTags;
988+
}
989+
980990
/**
981991
* Set quantity for product
982992
*
@@ -2158,7 +2168,7 @@ public function reset()
21582168
*/
21592169
public function getCacheIdTags()
21602170
{
2161-
// phpstan:ignore
2171+
// phpstan:ignore "Call to an undefined static method"
21622172
$tags = parent::getCacheIdTags();
21632173
$affectedCategoryIds = $this->getAffectedCategoryIds();
21642174
if (!$affectedCategoryIds) {
@@ -2339,7 +2349,8 @@ public function isDisabled()
23392349
public function getImage()
23402350
{
23412351
$this->getTypeInstance()->setImageFromChildProduct($this);
2342-
// phpstan:ignore
2352+
2353+
// phpstan:ignore "Call to an undefined static method"
23432354
return parent::getImage();
23442355
}
23452356

@@ -2403,6 +2414,8 @@ public function reloadPriceInfo()
24032414
}
24042415
}
24052416

2417+
//phpcs:disable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.MethodDoubleUnderscore
2418+
24062419
/**
24072420
* Return Data Object data in array format.
24082421
*
@@ -2430,6 +2443,8 @@ public function __toArray() //phpcs:ignore PHPCompatibility.FunctionNameRestrict
24302443
return $data;
24312444
}
24322445

2446+
//phpcs:enable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.MethodDoubleUnderscore
2447+
24332448
/**
24342449
* Convert Category model into flat array.
24352450
*
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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\ProductRepositoryInterface;
11+
use Magento\Framework\App\RequestInterface;
12+
use Magento\Framework\Exception\NoSuchEntityException;
13+
use Magento\PageCache\Model\Spi\PageCacheTagsPreprocessorInterface;
14+
use Magento\Store\Model\StoreManagerInterface;
15+
16+
/**
17+
* Add product identities to "noroute" page
18+
*
19+
* Ensure that "noroute" page has necessary product tags
20+
* so it can be invalidated once the product becomes visible again
21+
*/
22+
class ProductNotFoundPageCacheTags implements PageCacheTagsPreprocessorInterface
23+
{
24+
private const NOROUTE_ACTION_NAME = 'cms_noroute_index';
25+
/**
26+
* @var ProductRepositoryInterface
27+
*/
28+
private $productRepository;
29+
/**
30+
* @var StoreManagerInterface
31+
*/
32+
private $storeManager;
33+
/**
34+
* @var RequestInterface
35+
*/
36+
private $request;
37+
38+
/**
39+
* @param RequestInterface $request
40+
* @param ProductRepositoryInterface $productRepository
41+
* @param StoreManagerInterface $storeManager
42+
*/
43+
public function __construct(
44+
RequestInterface $request,
45+
ProductRepositoryInterface $productRepository,
46+
StoreManagerInterface $storeManager
47+
) {
48+
$this->productRepository = $productRepository;
49+
$this->storeManager = $storeManager;
50+
$this->request = $request;
51+
}
52+
53+
/**
54+
* @inheritDoc
55+
*/
56+
public function process(array $tags): array
57+
{
58+
if ($this->request->getFullActionName() === self::NOROUTE_ACTION_NAME) {
59+
try {
60+
$productId = (int) $this->request->getParam('id');
61+
$product = $this->productRepository->getById(
62+
$productId,
63+
false,
64+
$this->storeManager->getStore()->getId()
65+
);
66+
} catch (NoSuchEntityException $e) {
67+
$product = null;
68+
}
69+
if ($product) {
70+
$tags = array_merge($tags, $product->getIdentities());
71+
}
72+
}
73+
return $tags;
74+
}
75+
}

app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType/AdminCreateSimpleProductSwitchToVirtualTest.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@
5454
<actionGroup ref="FilterProductGridByNameActionGroup" stepKey="searchForProduct">
5555
<argument name="product" value="_defaultProduct"/>
5656
</actionGroup>
57-
<see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Virtual Product" stepKey="seeProductTypeInGrid"/>
57+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeProductTypeInGrid">
58+
<argument name="row" value="1"/>
59+
<argument name="column" value="Type"/>
60+
<argument name="value" value="Virtual Product"/>
61+
</actionGroup>
5862
<actionGroup ref="AssertProductInStorefrontProductPageActionGroup" stepKey="AssertProductInStorefrontProductPage">
5963
<argument name="product" value="_defaultProduct"/>
6064
</actionGroup>

app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndSwitchProductType/AdminCreateVirtualProductSwitchToSimpleTest.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
<actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm">
2626
<argument name="product" value="_defaultProduct"/>
2727
</actionGroup>
28-
<see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Simple Product" stepKey="seeProductTypeInGrid"/>
28+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeProductTypeInGrid">
29+
<argument name="row" value="1"/>
30+
<argument name="column" value="Type"/>
31+
<argument name="value" value="Simple Product"/>
32+
</actionGroup>
2933
</test>
3034
</tests>

app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest/AdminDownloadableProductTypeSwitchingToSimpleProductTest.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,16 @@
3333
<actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterSimpleProductGridBySku">
3434
<argument name="sku" value="$$createProduct.sku$$"/>
3535
</actionGroup>
36-
<see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="$$createProduct.name$$" stepKey="seeSimpleProductNameInGrid"/>
37-
<see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Simple Product" stepKey="seeSimpleProductTypeInGrid"/>
36+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeSimpleProductNameInGrid">
37+
<argument name="row" value="1"/>
38+
<argument name="column" value="Name"/>
39+
<argument name="value" value="$$createProduct.name$$"/>
40+
</actionGroup>
41+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeSimpleProductTypeInGrid">
42+
<argument name="row" value="1"/>
43+
<argument name="column" value="Type"/>
44+
<argument name="value" value="Simple Product"/>
45+
</actionGroup>
3846
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearSimpleProductFilters"/>
3947
<!--Assert simple product on storefront-->
4048
<comment userInput="Assert simple product on storefront" stepKey="commentAssertSimpleProductOnStorefront"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest/AdminVirtualProductTypeSwitchingToDownloadableProductTest.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,16 @@
5353
<actionGroup ref="FilterProductGridBySku2ActionGroup" stepKey="filterProductGridBySku">
5454
<argument name="sku" value="$$createProduct.sku$$"/>
5555
</actionGroup>
56-
<see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="$$createProduct.name$$" stepKey="seeDownloadableProductNameInGrid"/>
57-
<see selector="{{AdminProductGridSection.productGridCell('1', 'Type')}}" userInput="Downloadable Product" stepKey="seeDownloadableProductTypeInGrid"/>
56+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeDownloadableProductNameInGrid">
57+
<argument name="row" value="1"/>
58+
<argument name="column" value="Name"/>
59+
<argument name="value" value="$$createProduct.name$$"/>
60+
</actionGroup>
61+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeDownloadableProductTypeInGrid">
62+
<argument name="row" value="1"/>
63+
<argument name="column" value="Type"/>
64+
<argument name="value" value="Downloadable Product"/>
65+
</actionGroup>
5866
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearDownloadableProductFilters"/>
5967
<!--Assert downloadable product on storefront-->
6068
<comment userInput="Assert downloadable product on storefront" stepKey="commentAssertDownloadableProductOnStorefront"/>

0 commit comments

Comments
 (0)