Skip to content

Commit 43a4079

Browse files
committed
Merge branch 'develop' of github.com:magento-pangolin/magento2ce into develop
2 parents 8fed232 + d955cc2 commit 43a4079

File tree

7 files changed

+81
-16
lines changed

7 files changed

+81
-16
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,11 @@ public function reindex()
10941094
if ($this->flatState->isFlatEnabled()) {
10951095
$flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
10961096
if (!$flatIndexer->isScheduled()) {
1097-
$flatIndexer->reindexRow($this->getId());
1097+
$idsList = [$this->getId()];
1098+
if ($this->dataHasChangedFor('url_key')) {
1099+
$idsList = array_merge($idsList, explode(',', $this->getAllChildren()));
1100+
}
1101+
$flatIndexer->reindexList($idsList);
10981102
}
10991103
}
11001104
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);

app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public function testReindexFlatEnabled($flatScheduled, $productScheduled, $expec
318318
->will($this->returnValue(true));
319319

320320
$this->flatIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($flatScheduled));
321-
$this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexRow')->with('123');
321+
$this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexList')->with(['123']);
322322

323323
$this->productIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($productScheduled));
324324
$this->productIndexer->expects($this->exactly($expectedProductReindexCall))->method('reindexList')->with($pathIds);

app/code/Magento/ConfigurableProduct/Model/Product/SaveHandler.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ public function execute($entity, $arguments = [])
6666
$this->saveConfigurableProductAttributes($entity, $configurableOptions);
6767
}
6868

69-
$configurableLinks = (array) $extensionAttributes->getConfigurableProductLinks();
70-
$this->resourceModel->saveProducts($entity, $configurableLinks);
69+
$configurableLinks = $extensionAttributes->getConfigurableProductLinks();
70+
if ($configurableLinks !== null) {
71+
$configurableLinks = (array)$configurableLinks;
72+
$this->resourceModel->saveProducts($entity, $configurableLinks);
73+
}
7174

7275
return $entity;
7376
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Swagger\Block;
7+
8+
use Magento\Framework\View\Element\Template;
9+
10+
/**
11+
* Block for swagger index page
12+
*
13+
* @api
14+
*/
15+
class Index extends Template
16+
{
17+
/**
18+
* @return mixed|string
19+
*/
20+
private function getParamStore()
21+
{
22+
return ($this->getRequest()->getParam('store')) ? $this->getRequest()->getParam('store') : 'all';
23+
}
24+
25+
/**
26+
* @return string
27+
*/
28+
public function getSchemaUrl()
29+
{
30+
return rtrim($this->getBaseUrl(), '/') . '/rest/' . $this->getParamStore() . '/schema?services=all';
31+
}
32+
}

app/code/Magento/Swagger/view/frontend/layout/swagger_index_index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<referenceContainer name="page.wrapper" remove="true"/>
4242
<referenceBlock name="requirejs-config" remove="true"/>
4343
<referenceContainer name="root">
44-
<block name="swaggerUiContent" class="Magento\Framework\View\Element\Template" template="Magento_Swagger::swagger-ui/index.phtml"/>
44+
<block name="swaggerUiContent" class="Magento\Swagger\Block\Index" template="Magento_Swagger::swagger-ui/index.phtml"/>
4545
</referenceContainer>
4646
</body>
4747
</page>

app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
/** @var \Magento\Framework\View\Element\Template $block */
1616

17-
$schemaUrl = rtrim($block->getBaseUrl(), '/') . '/rest/all/schema?services=all';
17+
$schemaUrl = $block->getSchemaUrl();
1818
?>
1919

2020
<div id='header'>

app/code/Magento/Theme/Model/Design/Config/Validator.php

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,8 @@ public function validate(DesignConfigInterface $designConfig)
6464
}
6565

6666
foreach ($elements as $name => $data) {
67-
// Load template object by configured template id
68-
$template = $this->templateFactory->create();
69-
$template->emulateDesign($designConfig->getScopeId());
7067
$templateId = $data['value'];
71-
if (is_numeric($templateId)) {
72-
$template->load($templateId);
73-
} else {
74-
$template->loadDefault($templateId);
75-
}
76-
$text = $template->getTemplateText();
77-
$template->revertDesign();
68+
$text = $this->getTemplateText($templateId, $designConfig);
7869
// Check if template body has a reference to the same config path
7970
if (preg_match_all(Template::CONSTRUCTION_TEMPLATE_PATTERN, $text, $constructions, PREG_SET_ORDER)) {
8071
foreach ($constructions as $construction) {
@@ -94,6 +85,41 @@ public function validate(DesignConfigInterface $designConfig)
9485
}
9586
}
9687

88+
/**
89+
* Returns store identifier if is store scope
90+
*
91+
* @param DesignConfigInterface $designConfig
92+
* @return string|bool
93+
*/
94+
private function getScopeId(DesignConfigInterface $designConfig)
95+
{
96+
if ($designConfig->getScope() == 'stores') {
97+
return $designConfig->getScopeId();
98+
}
99+
return false;
100+
}
101+
/**
102+
* Load template text in configured scope
103+
*
104+
* @param integer|string $templateId
105+
* @param DesignConfigInterface $designConfig
106+
* @return string
107+
*/
108+
private function getTemplateText($templateId, DesignConfigInterface $designConfig)
109+
{
110+
// Load template object by configured template id
111+
$template = $this->templateFactory->create();
112+
$template->emulateDesign($this->getScopeId($designConfig));
113+
if (is_numeric($templateId)) {
114+
$template->load($templateId);
115+
} else {
116+
$template->loadDefault($templateId);
117+
}
118+
$text = $template->getTemplateText();
119+
$template->revertDesign();
120+
return $text;
121+
}
122+
97123
/**
98124
* Return associative array of parameters.
99125
*

0 commit comments

Comments
 (0)