File tree 5 files changed +66
-6
lines changed
Catalog/Model/Product/Attribute/Backend
Eav/Model/Entity/Attribute 5 files changed +66
-6
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ public function beforeSave($object)
25
25
$ attributeCode = $ this ->getAttribute ()->getName ();
26
26
if ($ object ->getData ('use_config_ ' . $ attributeCode )) {
27
27
$ object ->setData ($ attributeCode , BooleanSource::VALUE_USE_CONFIG );
28
+ return $ this ;
28
29
}
29
- return $ this ;
30
+
31
+ return parent ::beforeSave ($ object );
30
32
}
31
33
}
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 6
6
*/
7
7
-->
8
8
<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 " >
10
10
<sequence >
11
11
<module name =" Magento_Catalog" />
12
12
</sequence >
Original file line number Diff line number Diff line change @@ -392,7 +392,7 @@ public function getIsVisibleOnFront()
392
392
}
393
393
394
394
/**
395
- * @return string|int|bool|float
395
+ * @return string|null
396
396
* @codeCoverageIgnore
397
397
*/
398
398
public function getDefaultValue ()
Original file line number Diff line number Diff line change @@ -203,12 +203,12 @@ public function getEntityValueId($entity)
203
203
/**
204
204
* Retrieve default value
205
205
*
206
- * @return mixed
206
+ * @return string
207
207
*/
208
208
public function getDefaultValue ()
209
209
{
210
210
if ($ this ->_defaultValue === null ) {
211
- if ($ this ->getAttribute ()->getDefaultValue ()) {
211
+ if ($ this ->getAttribute ()->getDefaultValue () !== null ) {
212
212
$ this ->_defaultValue = $ this ->getAttribute ()->getDefaultValue ();
213
213
} else {
214
214
$ this ->_defaultValue = "" ;
@@ -280,7 +280,7 @@ public function afterLoad($object)
280
280
public function beforeSave ($ object )
281
281
{
282
282
$ attrCode = $ this ->getAttribute ()->getAttributeCode ();
283
- if (!$ object ->hasData ($ attrCode ) && $ this ->getDefaultValue ()) {
283
+ if (!$ object ->hasData ($ attrCode ) && $ this ->getDefaultValue () !== '' ) {
284
284
$ object ->setData ($ attrCode , $ this ->getDefaultValue ());
285
285
}
286
286
You can’t perform that action at this time.
0 commit comments