Skip to content

Commit fa03684

Browse files
committed
Merge remote-tracking branch 'performance/application-server' into ACPT-1224
2 parents 35d9e26 + 119f6d0 commit fa03684

File tree

70 files changed

+14781
-14526
lines changed

Some content is hidden

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

70 files changed

+14781
-14526
lines changed

app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR
215215
* @param Option $option
216216
* @param bool $canSkipRequiredOption
217217
* @return bool
218-
* @deprecated 100.2.0
218+
* @deprecated 100.2.0 Not used anymore.
219+
* @see Nothing
219220
*/
220221
protected function canSkipOption($option, $canSkipRequiredOption)
221222
{
@@ -227,7 +228,8 @@ protected function canSkipOption($option, $canSkipRequiredOption)
227228
*
228229
* @param Product $bundleProduct
229230
* @return bool
230-
* @deprecated 100.2.0
231+
* @deprecated 100.2.0 Not used anymore.
232+
* @see Nothing
231233
*/
232234
protected function hasRequiredOption($bundleProduct)
233235
{
@@ -246,6 +248,7 @@ function ($item) {
246248
* @param Product $saleableItem
247249
* @return \Magento\Bundle\Model\ResourceModel\Option\Collection
248250
* @deprecated 100.2.0
251+
* @see Nothing
249252
*/
250253
protected function getBundleOptions(Product $saleableItem)
251254
{

app/code/Magento/Bundle/Pricing/Price/BundleOptions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public function calculateOptions(
9292
/** @var \Magento\Bundle\Pricing\Price\BundleSelectionPrice $selectionPriceList */
9393
$selectionPriceList = $this->calculator->createSelectionPriceList($option, $bundleProduct);
9494
$selectionPriceList = $this->calculator->processOptions($option, $selectionPriceList, $searchMin);
95+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
9596
$priceList = array_merge($priceList, $selectionPriceList);
9697
}
9798
$amount = $this->calculator->calculateBundleAmount(0., $bundleProduct, $priceList);

app/code/Magento/Bundle/Pricing/Price/BundleRegularPrice.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Bundle\Pricing\Price;
88

99
use Magento\Bundle\Pricing\Adjustment\BundleCalculatorInterface;
10+
use Magento\Catalog\Pricing\Price\RegularPrice;
1011
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1112
use Magento\Framework\Pricing\Amount\AmountInterface;
1213
use Magento\Catalog\Pricing\Price\CustomOptionPrice;
@@ -15,7 +16,7 @@
1516
/**
1617
* Bundle product regular price model
1718
*/
18-
class BundleRegularPrice extends \Magento\Catalog\Pricing\Price\RegularPrice implements RegularPriceInterface, ResetAfterRequestInterface
19+
class BundleRegularPrice extends RegularPrice implements RegularPriceInterface, ResetAfterRequestInterface
1920
{
2021
/**
2122
* @var BundleCalculatorInterface

app/code/Magento/BundleGraphQl/Model/Resolver/BundleItems.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ public function __construct(
5858
}
5959

6060
/**
61-
* Fetch and format bundle option items.
62-
*
6361
* @inheritDoc
6462
*/
6563
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2626
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2727
*/
28-
class Bundle extends \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
29-
implements ResetAfterRequestInterface
28+
class Bundle extends \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType implements
29+
ResetAfterRequestInterface
3030
{
3131
/**
3232
* Delimiter before product option value.
@@ -796,6 +796,4 @@ public function _resetState(): void
796796
$this->_cachedOptionSelectQuery = [];
797797
$this->_cachedSkuToProducts = [];
798798
}
799-
800-
801799
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
*/
2020
class Category extends AbstractHelper implements ResetAfterRequestInterface
2121
{
22-
const XML_PATH_USE_CATEGORY_CANONICAL_TAG = 'catalog/seo/category_canonical_tag';
22+
public const XML_PATH_USE_CATEGORY_CANONICAL_TAG = 'catalog/seo/category_canonical_tag';
2323

24-
const XML_PATH_CATEGORY_ROOT_ID = 'catalog/category/root_id';
24+
public const XML_PATH_CATEGORY_ROOT_ID = 'catalog/category/root_id';
2525

2626
/**
2727
* Store categories cache
@@ -31,14 +31,14 @@ class Category extends AbstractHelper implements ResetAfterRequestInterface
3131
protected $_storeCategories = [];
3232

3333
/**
34-
* Store manager
34+
* Store manager instance
3535
*
3636
* @var \Magento\Store\Model\StoreManagerInterface
3737
*/
3838
protected $_storeManager;
3939

4040
/**
41-
* Category factory
41+
* Category factory instance
4242
*
4343
* @var \Magento\Catalog\Model\CategoryFactory
4444
*/

app/code/Magento/Catalog/Model/Layer/FilterList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
*/
1717
class FilterList implements ResetAfterRequestInterface
1818
{
19-
const CATEGORY_FILTER = 'category';
20-
const ATTRIBUTE_FILTER = 'attribute';
21-
const PRICE_FILTER = 'price';
22-
const DECIMAL_FILTER = 'decimal';
19+
public const CATEGORY_FILTER = 'category';
20+
public const ATTRIBUTE_FILTER = 'attribute';
21+
public const PRICE_FILTER = 'price';
22+
public const DECIMAL_FILTER = 'decimal';
2323

2424
/**
2525
* Filter factory

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/AttributeOptionProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function getOptions(array $optionIds, ?int $storeId, array $attributeCode
6363
'attribute_id' => 'a.attribute_id',
6464
'attribute_code' => 'a.attribute_code',
6565
'attribute_label' => 'a.frontend_label',
66+
'attribute_type' => 'a.frontend_input',
6667
'position' => 'attribute_configuration.position'
6768
]
6869
)
@@ -137,6 +138,7 @@ private function formatResult(Select $select): array
137138
'attribute_code' => $option['attribute_code'],
138139
'attribute_label' => $option['attribute_store_label']
139140
? $option['attribute_store_label'] : $option['attribute_label'],
141+
'attribute_type' => $option['attribute_type'],
140142
'position' => $option['position'],
141143
'options' => [],
142144
];

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Attribute.php

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\Api\Search\AggregationValueInterface;
1414
use Magento\Framework\Api\Search\BucketInterface;
1515
use Magento\CatalogGraphQl\DataProvider\Product\LayeredNavigation\Formatter\LayerFormatter;
16+
use Magento\Config\Model\Config\Source\Yesno;
1617

1718
/**
1819
* @inheritdoc
@@ -49,18 +50,26 @@ class Attribute implements LayerBuilderInterface
4950
self::CATEGORY_BUCKET
5051
];
5152

53+
/**
54+
* @var Yesno
55+
*/
56+
private Yesno $YesNo;
57+
5258
/**
5359
* @param AttributeOptionProvider $attributeOptionProvider
5460
* @param LayerFormatter $layerFormatter
61+
* @param Yesno $YesNo
5562
* @param array $bucketNameFilter
5663
*/
5764
public function __construct(
5865
AttributeOptionProvider $attributeOptionProvider,
5966
LayerFormatter $layerFormatter,
67+
Yesno $YesNo,
6068
$bucketNameFilter = []
6169
) {
6270
$this->attributeOptionProvider = $attributeOptionProvider;
6371
$this->layerFormatter = $layerFormatter;
72+
$this->YesNo = $YesNo;
6473
$this->bucketNameFilter = \array_merge($this->bucketNameFilter, $bucketNameFilter);
6574
}
6675

@@ -87,7 +96,11 @@ public function build(AggregationInterface $aggregation, ?int $storeId): array
8796
isset($attribute['position']) ? $attribute['position'] : null
8897
);
8998

90-
$options = $this->getSortedOptions($bucket, isset($attribute['options']) ? $attribute['options'] : []);
99+
$options = $this->getSortedOptions(
100+
$bucket,
101+
isset($attribute['options']) ? $attribute['options'] : [],
102+
($attribute['attribute_type']) ? $attribute['attribute_type']: ''
103+
);
91104
foreach ($options as $option) {
92105
$result[$bucketName]['options'][] = $this->layerFormatter->buildItem(
93106
$option['label'],
@@ -168,9 +181,11 @@ function (AggregationValueInterface $value) {
168181
*
169182
* @param BucketInterface $bucket
170183
* @param array $optionLabels
184+
* @param string $attributeType
171185
* @return array
186+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
172187
*/
173-
private function getSortedOptions(BucketInterface $bucket, array $optionLabels): array
188+
private function getSortedOptions(BucketInterface $bucket, array $optionLabels, string $attributeType): array
174189
{
175190
/**
176191
* Option labels array has been sorted
@@ -179,7 +194,16 @@ private function getSortedOptions(BucketInterface $bucket, array $optionLabels):
179194
foreach ($bucket->getValues() as $value) {
180195
$metrics = $value->getMetrics();
181196
$optionValue = $metrics['value'];
182-
$optionLabel = $optionLabels[$optionValue] ?? $optionValue;
197+
if (isset($optionLabels[$optionValue])) {
198+
$optionLabel = $optionLabels[$optionValue];
199+
} else {
200+
if ($attributeType === 'boolean') {
201+
$yesNoOptions = $this->YesNo->toArray();
202+
$optionLabel = $yesNoOptions[$optionValue];
203+
} else {
204+
$optionLabel = $optionValue;
205+
}
206+
}
183207
$options[$optionValue] = $metrics + ['label' => $optionLabel];
184208
}
185209

@@ -188,7 +212,7 @@ private function getSortedOptions(BucketInterface $bucket, array $optionLabels):
188212
*/
189213
foreach ($options as $optionId => $option) {
190214
if (!is_array($options[$optionId])) {
191-
unset($options[$optionId]);
215+
unset($options[$optionId]);
192216
}
193217
}
194218

app/code/Magento/CatalogGraphQl/Model/AttributesJoiner.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function join(FieldNode $fieldNode, AbstractCollection $collection, Resol
6161
*
6262
* @param FieldNode $fieldNode
6363
* @param ResolveInfo $resolveInfo
64+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
6465
* @return string[]
6566
*/
6667
public function getQueryFields(FieldNode $fieldNode, ResolveInfo $resolveInfo): array
@@ -77,7 +78,11 @@ public function getQueryFields(FieldNode $fieldNode, ResolveInfo $resolveInfo):
7778
($spreadFragmentNode = $resolveInfo->fragments[$field->name->value])) {
7879

7980
foreach ($spreadFragmentNode->selectionSet->selections as $spreadNode) {
80-
if (isset($spreadNode->selectionSet->selections)) {
81+
if (isset($spreadNode->selectionSet->selections)
82+
&& $spreadNode->kind === NodeKind::INLINE_FRAGMENT) {
83+
$fragmentFields[] = $this->addInlineFragmentFields($resolveInfo, $spreadNode);
84+
} elseif (isset($spreadNode->selectionSet->selections)
85+
&& $spreadNode->kind !== NodeKind::INLINE_FRAGMENT) {
8186
$fragmentFields[] = $this->getQueryFields($spreadNode, $resolveInfo);
8287
} else {
8388
$selectedFields[] = $spreadNode->name->value;

0 commit comments

Comments
 (0)