14
14
use Magento \Framework \Model \Entity \ScopeInterface ;
15
15
use Magento \Framework \EntityManager \Operation \AttributeInterface ;
16
16
use Magento \Eav \Model \Entity \AttributeCache ;
17
+ use Psr \Log \LoggerInterface ;
17
18
18
19
/**
19
20
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -51,7 +52,7 @@ class ReadHandler implements AttributeInterface
51
52
protected $ scopeResolver ;
52
53
53
54
/**
54
- * @var \Psr\Log\ LoggerInterface
55
+ * @var LoggerInterface
55
56
*/
56
57
private $ logger ;
57
58
@@ -64,21 +65,24 @@ class ReadHandler implements AttributeInterface
64
65
* @param AppResource $appResource
65
66
* @param ScopeResolver $scopeResolver
66
67
* @param AttributeCache $attributeCache
68
+ * @param LoggerInterface $logger
67
69
*/
68
70
public function __construct (
69
71
AttributeRepository $ attributeRepository ,
70
72
MetadataPool $ metadataPool ,
71
73
SearchCriteriaBuilder $ searchCriteriaBuilder ,
72
74
AppResource $ appResource ,
73
75
ScopeResolver $ scopeResolver ,
74
- AttributeCache $ attributeCache
76
+ AttributeCache $ attributeCache ,
77
+ LoggerInterface $ logger
75
78
) {
76
79
$ this ->attributeRepository = $ attributeRepository ;
77
80
$ this ->metadataPool = $ metadataPool ;
78
81
$ this ->searchCriteriaBuilder = $ searchCriteriaBuilder ;
79
82
$ this ->appResource = $ appResource ;
80
83
$ this ->scopeResolver = $ scopeResolver ;
81
84
$ this ->attributeCache = $ attributeCache ;
85
+ $ this ->logger = $ logger ;
82
86
}
83
87
84
88
/**
@@ -172,7 +176,7 @@ public function execute($entityType, $entityData, $arguments = [])
172
176
if (isset ($ attributesMap [$ attributeValue ['attribute_id ' ]])) {
173
177
$ entityData [$ attributesMap [$ attributeValue ['attribute_id ' ]]] = $ attributeValue ['value ' ];
174
178
} else {
175
- $ this ->getLogger () ->warning (
179
+ $ this ->logger ->warning (
176
180
"Attempt to load value of nonexistent EAV attribute ' {$ attributeValue ['attribute_id ' ]}'
177
181
for entity type ' $ entityType'. "
178
182
);
@@ -181,18 +185,4 @@ public function execute($entityType, $entityData, $arguments = [])
181
185
}
182
186
return $ entityData ;
183
187
}
184
-
185
- /**
186
- * Get logger
187
- *
188
- * @return \Psr\Log\LoggerInterface
189
- * @deprecated
190
- */
191
- private function getLogger ()
192
- {
193
- if ($ this ->logger == null ) {
194
- $ this ->logger = ObjectManager::getInstance ()->get (\Psr \Log \LoggerInterface::class);
195
- }
196
- return $ this ->logger ;
197
- }
198
188
}
0 commit comments