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

Commit 0698aa6

Browse files
author
al.kravchuk
committed
magento/magento2#14510: Creating custom customer attribute with default value 0 will cause not saving value for customer entity.
- remove default value for 'links_exist' attribute of Downloadable Product;
1 parent 5fa4d5f commit 0698aa6

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed
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>

0 commit comments

Comments
 (0)