Skip to content

Commit 584b8f8

Browse files
committed
Merge branch '2.3-develop' of github.com:magento/graphql-ce into 2.3-develop#354
2 parents 8fafd29 + 3b2e305 commit 584b8f8

File tree

175 files changed

+4236
-856
lines changed

Some content is hidden

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

175 files changed

+4236
-856
lines changed

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

+16-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Magento\AsynchronousOperations\Model;
1010

1111
use Magento\Framework\App\ResourceConnection;
12+
use Magento\Framework\Registry;
1213
use Psr\Log\LoggerInterface;
1314
use Magento\Framework\MessageQueue\MessageLockException;
1415
use Magento\Framework\MessageQueue\ConnectionLostException;
@@ -58,6 +59,11 @@ class MassConsumer implements ConsumerInterface
5859
*/
5960
private $operationProcessor;
6061

62+
/**
63+
* @var Registry
64+
*/
65+
private $registry;
66+
6167
/**
6268
* Initialize dependencies.
6369
*
@@ -67,14 +73,16 @@ class MassConsumer implements ConsumerInterface
6773
* @param ConsumerConfigurationInterface $configuration
6874
* @param OperationProcessorFactory $operationProcessorFactory
6975
* @param LoggerInterface $logger
76+
* @param Registry $registry
7077
*/
7178
public function __construct(
7279
CallbackInvoker $invoker,
7380
ResourceConnection $resource,
7481
MessageController $messageController,
7582
ConsumerConfigurationInterface $configuration,
7683
OperationProcessorFactory $operationProcessorFactory,
77-
LoggerInterface $logger
84+
LoggerInterface $logger,
85+
Registry $registry = null
7886
) {
7987
$this->invoker = $invoker;
8088
$this->resource = $resource;
@@ -84,20 +92,26 @@ public function __construct(
8492
'configuration' => $configuration
8593
]);
8694
$this->logger = $logger;
95+
$this->registry = $registry ?? \Magento\Framework\App\ObjectManager::getInstance()
96+
->get(Registry::class);
8797
}
8898

8999
/**
90-
* {@inheritdoc}
100+
* @inheritdoc
91101
*/
92102
public function process($maxNumberOfMessages = null)
93103
{
104+
$this->registry->register('isSecureArea', true, true);
105+
94106
$queue = $this->configuration->getQueue();
95107

96108
if (!isset($maxNumberOfMessages)) {
97109
$queue->subscribe($this->getTransactionCallback($queue));
98110
} else {
99111
$this->invoker->invoke($queue, $maxNumberOfMessages, $this->getTransactionCallback($queue));
100112
}
113+
114+
$this->registry->unregister('isSecureArea');
101115
}
102116

103117
/**

app/code/Magento/Bundle/view/adminhtml/templates/catalog/product/edit/tab/attributes/extend.phtml

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ $isElementReadonly = $block->getElement()
2020
->getReadonly();
2121
?>
2222

23-
<?php if (!($attributeCode === 'price' && $block->getCanReadPrice() === false)) { ?>
23+
<?php if (!($attributeCode === 'price' && $block->getCanReadPrice() === false)): ?>
2424
<div class="<?= /* @escapeNotVerified */ $attributeCode ?> "><?= /* @escapeNotVerified */ $elementHtml ?></div>
25-
<?php } ?>
25+
<?php endif; ?>
2626

2727
<?= $block->getExtendedElement($switchAttributeCode)->toHtml() ?>
2828

@@ -43,13 +43,13 @@ $isElementReadonly = $block->getElement()
4343
} else {
4444
if ($attribute) {
4545
<?php if ($attributeCode === 'price' && !$block->getCanEditPrice() && $block->getCanReadPrice()
46-
&& $block->getProduct()->isObjectNew()) { ?>
46+
&& $block->getProduct()->isObjectNew()): ?>
4747
<?php $defaultProductPrice = $block->getDefaultProductPrice() ?: "''"; ?>
4848
$attribute.value = <?= /* @escapeNotVerified */ $defaultProductPrice ?>;
49-
<?php } else { ?>
49+
<?php else: ?>
5050
$attribute.disabled = false;
5151
$attribute.addClassName('required-entry');
52-
<?php } ?>
52+
<?php endif; ?>
5353
}
5454
if ($('dynamic-price-warning')) {
5555
$('dynamic-price-warning').hide();
@@ -58,9 +58,9 @@ $isElementReadonly = $block->getElement()
5858
}
5959

6060
<?php if (!($attributeCode === 'price' && !$block->getCanEditPrice()
61-
&& !$block->getProduct()->isObjectNew())) { ?>
61+
&& !$block->getProduct()->isObjectNew())): ?>
6262
$('<?= /* @escapeNotVerified */ $switchAttributeCode ?>').observe('change', <?= /* @escapeNotVerified */ $switchAttributeCode ?>_change);
63-
<?php } ?>
63+
<?php endif; ?>
6464
Event.observe(window, 'load', function(){
6565
<?= /* @escapeNotVerified */ $switchAttributeCode ?>_change();
6666
});

app/code/Magento/Catalog/Block/Product/View/Attributes.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use Magento\Framework\Pricing\PriceCurrencyInterface;
1717

1818
/**
19+
* Attributes attributes block
20+
*
1921
* @api
2022
* @since 100.0.2
2123
*/
@@ -56,6 +58,8 @@ public function __construct(
5658
}
5759

5860
/**
61+
* Returns a Product
62+
*
5963
* @return Product
6064
*/
6165
public function getProduct()
@@ -88,7 +92,7 @@ public function getAdditionalData(array $excludeAttr = [])
8892
$value = $this->priceCurrency->convertAndFormat($value);
8993
}
9094

91-
if (is_string($value) && strlen($value)) {
95+
if (is_string($value) && strlen(trim($value))) {
9296
$data[$attribute->getAttributeCode()] = [
9397
'label' => __($attribute->getStoreLabel()),
9498
'value' => $value,

app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
/**
2121
* Reports Viewed Products Counter
2222
*
23-
* The main responsilibity of this class is provide necessary data to track viewed products
24-
* by customer on frontend and data to synchornize this tracks with backend
23+
* The main responsibility of this class is provide necessary data to track viewed products
24+
* by customer on frontend and data to synchronize this tracks with backend
2525
*
2626
* @api
2727
* @since 101.1.0
@@ -109,6 +109,8 @@ public function __construct(
109109
*
110110
* @return string {JSON encoded data}
111111
* @since 101.1.0
112+
* @throws \Magento\Framework\Exception\LocalizedException
113+
* @throws \Magento\Framework\Exception\NoSuchEntityException
112114
*/
113115
public function getCurrentProductData()
114116
{

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function execute()
105105
$attributeCode
106106
);
107107

108-
if ($attribute->getId() && !$attributeId || $attributeCode === 'product_type') {
108+
if ($attribute->getId() && !$attributeId || $attributeCode === 'product_type' || $attributeCode === 'type_id') {
109109
$message = strlen($this->getRequest()->getParam('attribute_code'))
110110
? __('An attribute with this code already exists.')
111111
: __('An attribute with the same code (%1) already exists.', $attributeCode);

app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
use Magento\Framework\App\ResourceConnection;
1010

11+
/**
12+
* Abstract action class for category flat indexers.
13+
*/
1114
class AbstractAction
1215
{
1316
/**
@@ -130,7 +133,7 @@ protected function getFlatTableStructure($tableName)
130133
$table = $this->connection->newTable(
131134
$tableName
132135
)->setComment(
133-
sprintf("Catalog Category Flat", $tableName)
136+
'Catalog Category Flat'
134137
);
135138

136139
//Adding columns
@@ -378,7 +381,7 @@ protected function getAttributeValues($entityIds, $storeId)
378381
$linkField = $this->getCategoryMetadata()->getLinkField();
379382
foreach ($attributesType as $type) {
380383
foreach ($this->getAttributeTypeValues($type, $entityIds, $storeId) as $row) {
381-
if (isset($row[$linkField]) && isset($row['attribute_id'])) {
384+
if (isset($row[$linkField], $row['attribute_id'])) {
382385
$attributeId = $row['attribute_id'];
383386
if (isset($attributes[$attributeId])) {
384387
$attributeCode = $attributes[$attributeId]['attribute_code'];
@@ -496,6 +499,8 @@ protected function getTableName($name)
496499
}
497500

498501
/**
502+
* Get category metadata instance.
503+
*
499504
* @return \Magento\Framework\EntityManager\EntityMetadata
500505
*/
501506
private function getCategoryMetadata()
@@ -509,6 +514,8 @@ private function getCategoryMetadata()
509514
}
510515

511516
/**
517+
* Get skip static columns instance.
518+
*
512519
* @return array
513520
*/
514521
private function getSkipStaticColumns()

app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function _isApplicableAttribute($object, $attribute)
9999
*/
100100
protected function _isCallableAttributeInstance($instance, $method, $args)
101101
{
102-
if ($instance instanceof \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
102+
if ($instance instanceof AbstractBackend
103103
&& ($method == 'beforeSave' || $method == 'afterSave')
104104
) {
105105
$attributeCode = $instance->getAttribute()->getAttributeCode();
@@ -491,7 +491,7 @@ protected function _canUpdateAttribute(AbstractAttribute $attribute, $value, arr
491491
* Retrieve attribute's raw value from DB.
492492
*
493493
* @param int $entityId
494-
* @param int|string|array $attribute atrribute's ids or codes
494+
* @param int|string|array $attribute attribute's ids or codes
495495
* @param int|\Magento\Store\Model\Store $store
496496
* @return bool|string|array
497497
* @SuppressWarnings(PHPMD.CyclomaticComplexity)

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds =
127127
}
128128

129129
/**
130+
* Check if custom options exist.
131+
*
130132
* @param IndexTableStructure $priceTable
131133
* @return bool
132134
* @throws \Exception
@@ -154,6 +156,8 @@ private function checkIfCustomOptionsExist(IndexTableStructure $priceTable): boo
154156
}
155157

156158
/**
159+
* Get connection.
160+
*
157161
* @return \Magento\Framework\DB\Adapter\AdapterInterface
158162
*/
159163
private function getConnection()
@@ -211,7 +215,7 @@ private function getSelectForOptionsWithMultipleValues(string $sourceTable): Sel
211215
} else {
212216
$select->joinLeft(
213217
['otps' => $this->getTable('catalog_product_option_type_price')],
214-
'otps.option_type_id = otpd.option_type_id AND otpd.store_id = cwd.default_store_id',
218+
'otps.option_type_id = otpd.option_type_id AND otps.store_id = cwd.default_store_id',
215219
[]
216220
);
217221

@@ -373,6 +377,8 @@ private function getSelectAggregated(string $sourceTable): Select
373377
}
374378

375379
/**
380+
* Get select for update.
381+
*
376382
* @param string $sourceTable
377383
* @return \Magento\Framework\DB\Select
378384
*/
@@ -402,6 +408,8 @@ private function getSelectForUpdate(string $sourceTable): Select
402408
}
403409

404410
/**
411+
* Get table name.
412+
*
405413
* @param string $tableName
406414
* @return string
407415
*/
@@ -411,6 +419,8 @@ private function getTable(string $tableName): string
411419
}
412420

413421
/**
422+
* Is price scope global.
423+
*
414424
* @return bool
415425
*/
416426
private function isPriceGlobal(): bool

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
/**
1212
* Default Product Type Price Indexer Resource model
13+
*
1314
* For correctly work need define product type id
1415
*
1516
* @api
@@ -208,6 +209,8 @@ public function reindexEntity($entityIds)
208209
}
209210

210211
/**
212+
* Reindex prices.
213+
*
211214
* @param null|int|array $entityIds
212215
* @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice
213216
*/
@@ -604,7 +607,7 @@ protected function _applyCustomOption()
604607
[]
605608
)->joinLeft(
606609
['otps' => $this->getTable('catalog_product_option_type_price')],
607-
'otps.option_type_id = otpd.option_type_id AND otpd.store_id = cs.store_id',
610+
'otps.option_type_id = otpd.option_type_id AND otps.store_id = cs.store_id',
608611
[]
609612
)->group(
610613
['i.entity_id', 'i.customer_group_id', 'i.website_id', 'o.option_id']
@@ -802,6 +805,8 @@ public function getIdxTable($table = null)
802805
}
803806

804807
/**
808+
* Check if product exists.
809+
*
805810
* @return bool
806811
*/
807812
protected function hasEntity()
@@ -823,6 +828,8 @@ protected function hasEntity()
823828
}
824829

825830
/**
831+
* Get total tier price expression.
832+
*
826833
* @param \Zend_Db_Expr $priceExpression
827834
* @return \Zend_Db_Expr
828835
*/
@@ -863,6 +870,8 @@ private function getTotalTierPriceExpression(\Zend_Db_Expr $priceExpression)
863870
}
864871

865872
/**
873+
* Get tier price expression for table.
874+
*
866875
* @param string $tableAlias
867876
* @param \Zend_Db_Expr $priceExpression
868877
* @return \Zend_Db_Expr

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use Magento\Framework\DB\Select;
1212
use Magento\Store\Model\Store;
1313

14+
/**
15+
* Provide Select object for retrieve product id with minimal price.
16+
*/
1417
class LinkedProductSelectBuilderByBasePrice implements LinkedProductSelectBuilderInterface
1518
{
1619
/**
@@ -69,7 +72,7 @@ public function __construct(
6972
}
7073

7174
/**
72-
* {@inheritdoc}
75+
* @inheritdoc
7376
*/
7477
public function build($productId)
7578
{
@@ -85,7 +88,7 @@ public function build($productId)
8588
[]
8689
)->joinInner(
8790
[BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS => $productTable],
88-
sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
91+
sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
8992
['entity_id']
9093
)->joinInner(
9194
['t' => $priceAttribute->getBackendTable()],

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryActionGroup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154

155155
<fillField stepKey="fillCategoryName" selector="{{AdminProductCategoryCreationSection.nameInput}}" userInput="{{categoryName}}"/>
156156

157-
<!-- Search and select a parent catagory for the product -->
157+
<!-- Search and select a parent category for the product -->
158158
<click stepKey="clickParentCategory" selector="{{AdminProductCategoryCreationSection.parentCategory}}"/>
159159
<waitForPageLoad stepKey="waitForDropDownVisible"/>
160160
<fillField stepKey="searchForParent" userInput="{{parentCategoryName}}" selector="{{AdminProductCategoryCreationSection.parentSearch}}"/>

0 commit comments

Comments
 (0)