Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit d418636

Browse files
committed
Merge branch '2.2-develop' into 2.2-develop-pr6
2 parents 60610d0 + 8fd8aca commit d418636

File tree

9 files changed

+92
-11
lines changed

9 files changed

+92
-11
lines changed

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Boolean.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ public function beforeSave($object)
2525
$attributeCode = $this->getAttribute()->getName();
2626
if ($object->getData('use_config_' . $attributeCode)) {
2727
$object->setData($attributeCode, BooleanSource::VALUE_USE_CONFIG);
28+
return $this;
2829
}
29-
return $this;
30+
31+
return parent::beforeSave($object);
3032
}
3133
}

app/code/Magento/CatalogImportExport/Model/Import/Product/CategoryProcessor.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ public function __construct(
6666
}
6767

6868
/**
69+
* Initialize categories to be processed
70+
*
6971
* @return $this
7072
*/
7173
protected function initCategories()
@@ -112,6 +114,9 @@ protected function createCategory($name, $parentId)
112114
if (!($parentCategory = $this->getCategoryById($parentId))) {
113115
$parentCategory = $this->categoryFactory->create()->load($parentId);
114116
}
117+
118+
// Set StoreId to 0 to generate URL Keys global and prevent generating url rewrites just for default website
119+
$category->setStoreId(0);
115120
$category->setPath($parentCategory->getPath());
116121
$category->setParentId($parentId);
117122
$category->setName($name);

app/code/Magento/CatalogUrlRewrite/Observer/ProductProcessUrlRewriteSavingObserver.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66
namespace Magento\CatalogUrlRewrite\Observer;
77

88
use Magento\Catalog\Model\Product;
9+
use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator;
910
use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator;
11+
use Magento\Framework\App\ObjectManager;
1012
use Magento\UrlRewrite\Model\UrlPersistInterface;
11-
use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;
1213
use Magento\Framework\Event\ObserverInterface;
1314

15+
/**
16+
* Class ProductProcessUrlRewriteSavingObserver
17+
*/
1418
class ProductProcessUrlRewriteSavingObserver implements ObserverInterface
1519
{
1620
/**
@@ -23,22 +27,33 @@ class ProductProcessUrlRewriteSavingObserver implements ObserverInterface
2327
*/
2428
private $urlPersist;
2529

30+
/**
31+
* @var ProductUrlPathGenerator
32+
*/
33+
private $productUrlPathGenerator;
34+
2635
/**
2736
* @param ProductUrlRewriteGenerator $productUrlRewriteGenerator
2837
* @param UrlPersistInterface $urlPersist
38+
* @param ProductUrlPathGenerator|null $productUrlPathGenerator
2939
*/
3040
public function __construct(
3141
ProductUrlRewriteGenerator $productUrlRewriteGenerator,
32-
UrlPersistInterface $urlPersist
42+
UrlPersistInterface $urlPersist,
43+
ProductUrlPathGenerator $productUrlPathGenerator = null
3344
) {
3445
$this->productUrlRewriteGenerator = $productUrlRewriteGenerator;
3546
$this->urlPersist = $urlPersist;
47+
$this->productUrlPathGenerator = $productUrlPathGenerator ?: ObjectManager::getInstance()
48+
->get(ProductUrlPathGenerator::class);
3649
}
3750

3851
/**
3952
* Generate urls for UrlRewrite and save it in storage
53+
*
4054
* @param \Magento\Framework\Event\Observer $observer
4155
* @return void
56+
* @throws \Magento\UrlRewrite\Model\Exception\UrlAlreadyExistsException
4257
*/
4358
public function execute(\Magento\Framework\Event\Observer $observer)
4459
{
@@ -51,6 +66,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
5166
|| $product->dataHasChangedFor('visibility')
5267
) {
5368
if ($product->isVisibleInSiteVisibility()) {
69+
$product->unsUrlPath();
70+
$product->setUrlPath($this->productUrlPathGenerator->getUrlPath($product));
5471
$this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
5572
}
5673
}

app/code/Magento/Customer/Model/GroupManagement.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Magento\Framework\Api\SortOrderBuilder;
1616
use Magento\Framework\App\Config\ScopeConfigInterface;
1717
use Magento\Framework\App\ObjectManager;
18-
use Magento\Framework\Data\Collection;
1918
use Magento\Framework\Exception\NoSuchEntityException;
2019
use Magento\Store\Model\StoreManagerInterface;
2120

@@ -170,7 +169,7 @@ public function getLoggedInGroups()
170169
->create();
171170
$groupNameSortOrder = $this->sortOrderBuilder
172171
->setField('customer_group_code')
173-
->setDirection(Collection::SORT_ORDER_ASC)
172+
->setAscendingDirection()
174173
->create();
175174
$searchCriteria = $this->searchCriteriaBuilder
176175
->addFilters($notLoggedInFilter)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Downloadable\Setup;
8+
9+
use Magento\Eav\Setup\EavSetup;
10+
use Magento\Eav\Setup\EavSetupFactory;
11+
use Magento\Framework\Setup\ModuleDataSetupInterface;
12+
use Magento\Framework\Setup\UpgradeDataInterface;
13+
use Magento\Framework\Setup\ModuleContextInterface;
14+
15+
/**
16+
* @codeCoverageIgnore
17+
*/
18+
class UpgradeData implements UpgradeDataInterface
19+
{
20+
/**
21+
* EAV setup factory
22+
*
23+
* @var EavSetupFactory
24+
*/
25+
private $eavSetupFactory;
26+
27+
/**
28+
* Init
29+
*
30+
* @param EavSetupFactory $eavSetupFactory
31+
*/
32+
public function __construct(EavSetupFactory $eavSetupFactory)
33+
{
34+
$this->eavSetupFactory = $eavSetupFactory;
35+
}
36+
37+
/**
38+
* @inheritdoc
39+
*/
40+
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
41+
{
42+
$setup->startSetup();
43+
44+
if (version_compare($context->getVersion(), '2.0.3', '<')) {
45+
/** @var EavSetup $eavSetup */
46+
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
47+
// remove default value
48+
$eavSetup->updateAttribute(
49+
\Magento\Catalog\Model\Product::ENTITY,
50+
'links_exist',
51+
'default_value',
52+
null
53+
);
54+
}
55+
56+
$setup->endSetup();
57+
}
58+
}

app/code/Magento/Downloadable/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Downloadable" setup_version="2.0.2">
9+
<module name="Magento_Downloadable" setup_version="2.0.3">
1010
<sequence>
1111
<module name="Magento_Catalog"/>
1212
</sequence>

app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ public function getIsVisibleOnFront()
392392
}
393393

394394
/**
395-
* @return string|int|bool|float
395+
* @return string|null
396396
* @codeCoverageIgnore
397397
*/
398398
public function getDefaultValue()

app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,12 @@ public function getEntityValueId($entity)
203203
/**
204204
* Retrieve default value
205205
*
206-
* @return mixed
206+
* @return string
207207
*/
208208
public function getDefaultValue()
209209
{
210210
if ($this->_defaultValue === null) {
211-
if ($this->getAttribute()->getDefaultValue()) {
211+
if ($this->getAttribute()->getDefaultValue() !== null) {
212212
$this->_defaultValue = $this->getAttribute()->getDefaultValue();
213213
} else {
214214
$this->_defaultValue = "";
@@ -280,7 +280,7 @@ public function afterLoad($object)
280280
public function beforeSave($object)
281281
{
282282
$attrCode = $this->getAttribute()->getAttributeCode();
283-
if (!$object->hasData($attrCode) && $this->getDefaultValue()) {
283+
if (!$object->hasData($attrCode) && $this->getDefaultValue() !== '') {
284284
$object->setData($attrCode, $this->getDefaultValue());
285285
}
286286

app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ protected function _getLoadAttributesSelect($table, $attributeIds = [])
12331233

12341234
if ($entity->getEntityTable() == \Magento\Eav\Model\Entity::DEFAULT_ENTITY_TABLE && $entity->getTypeId()) {
12351235
$select->where(
1236-
'entity_type_id =?',
1236+
't_d.entity_type_id =?',
12371237
$entity->getTypeId()
12381238
);
12391239
}

0 commit comments

Comments
 (0)