7
7
8
8
use Magento \Customer \Api \Data \OptionInterfaceFactory ;
9
9
use Magento \Customer \Api \Data \ValidationRuleInterfaceFactory ;
10
+ use Magento \Customer \Api \Data \AttributeMetadataInterfaceFactory ;
10
11
11
12
/**
12
13
* Converter for AttributeMetadata
@@ -24,9 +25,9 @@ class AttributeMetadataConverter
24
25
private $ validationRuleFactory ;
25
26
26
27
/**
27
- * @var AttributeMetadataDataBuilder
28
+ * @var AttributeMetadataInterfaceFactory
28
29
*/
29
- private $ _attributeMetadataBuilder ;
30
+ private $ attributeMetadataFactory ;
30
31
31
32
/**
32
33
* @var \Magento\Framework\Api\DataObjectHelper
@@ -37,18 +38,18 @@ class AttributeMetadataConverter
37
38
*
38
39
* @param OptionInterfaceFactory $optionFactory
39
40
* @param ValidationRuleInterfaceFactory $validationRuleFactory
40
- * @param AttributeMetadataDataBuilder $attributeMetadataBuilder
41
+ * @param AttributeMetadataInterfaceFactory $attributeMetadataFactory
41
42
* @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper
42
43
*/
43
44
public function __construct (
44
45
OptionInterfaceFactory $ optionFactory ,
45
46
ValidationRuleInterfaceFactory $ validationRuleFactory ,
46
- AttributeMetadataDataBuilder $ attributeMetadataBuilder ,
47
+ AttributeMetadataInterfaceFactory $ attributeMetadataFactory ,
47
48
\Magento \Framework \Api \DataObjectHelper $ dataObjectHelper
48
49
) {
49
50
$ this ->optionFactory = $ optionFactory ;
50
51
$ this ->validationRuleFactory = $ validationRuleFactory ;
51
- $ this ->_attributeMetadataBuilder = $ attributeMetadataBuilder ;
52
+ $ this ->attributeMetadataFactory = $ attributeMetadataFactory ;
52
53
$ this ->dataObjectHelper = $ dataObjectHelper ;
53
54
}
54
55
@@ -87,24 +88,23 @@ public function createMetadataAttribute($attribute)
87
88
$ validationRules [] = $ validationRule ;
88
89
}
89
90
90
- $ this ->_attributeMetadataBuilder ->setAttributeCode ($ attribute ->getAttributeCode ())
91
+
92
+ return $ this ->attributeMetadataFactory ->create ()->setAttributeCode ($ attribute ->getAttributeCode ())
91
93
->setFrontendInput ($ attribute ->getFrontendInput ())
92
94
->setInputFilter ((string )$ attribute ->getInputFilter ())
93
95
->setStoreLabel ($ attribute ->getStoreLabel ())
94
96
->setValidationRules ($ validationRules )
95
- ->setVisible ((boolean )$ attribute ->getIsVisible ())
96
- ->setRequired ((boolean )$ attribute ->getIsRequired ())
97
+ ->setIsVisible ((boolean )$ attribute ->getIsVisible ())
98
+ ->setIsRequired ((boolean )$ attribute ->getIsRequired ())
97
99
->setMultilineCount ((int )$ attribute ->getMultilineCount ())
98
100
->setDataModel ((string )$ attribute ->getDataModel ())
99
101
->setOptions ($ options )
100
102
->setFrontendClass ($ attribute ->getFrontend ()->getClass ())
101
103
->setFrontendLabel ($ attribute ->getFrontendLabel ())
102
104
->setNote ((string )$ attribute ->getNote ())
103
- ->setSystem ((boolean )$ attribute ->getIsSystem ())
104
- ->setUserDefined ((boolean )$ attribute ->getIsUserDefined ())
105
+ ->setIsSystem ((boolean )$ attribute ->getIsSystem ())
106
+ ->setIsUserDefined ((boolean )$ attribute ->getIsUserDefined ())
105
107
->setBackendType ($ attribute ->getBackendType ())
106
108
->setSortOrder ((int )$ attribute ->getSortOrder ());
107
-
108
- return $ this ->_attributeMetadataBuilder ->create ();
109
109
}
110
110
}
0 commit comments