Skip to content

Commit 155cdc0

Browse files
author
cspruiell
committed
MAGETWO-58742: [Backport] After upgrading from 2.0.7 to 2.1, editing a category gives a 500 error - for 2.1.3
- Merge remote-tracking branch 'origin/MAGETWO-58742-category_500_error_2.1.3' into okapis-2.1.3-pr
2 parents 6b3eb27 + 0abadb1 commit 155cdc0

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,35 @@ class ReadHandler implements AttributeInterface
6464
* @param AppResource $appResource
6565
* @param ScopeResolver $scopeResolver
6666
* @param AttributeCache $attributeCache
67-
* @param LoggerInterface $logger
6867
*/
6968
public function __construct(
7069
AttributeRepository $attributeRepository,
7170
MetadataPool $metadataPool,
7271
SearchCriteriaBuilder $searchCriteriaBuilder,
7372
AppResource $appResource,
7473
ScopeResolver $scopeResolver,
75-
AttributeCache $attributeCache,
76-
LoggerInterface $logger
74+
AttributeCache $attributeCache
7775
) {
7876
$this->attributeRepository = $attributeRepository;
7977
$this->metadataPool = $metadataPool;
8078
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
8179
$this->appResource = $appResource;
8280
$this->scopeResolver = $scopeResolver;
8381
$this->attributeCache = $attributeCache;
84-
$this->logger = $logger;
82+
}
83+
84+
/**
85+
* Get Logger
86+
*
87+
* @return LoggerInterface
88+
* @deprecated
89+
*/
90+
private function getLogger()
91+
{
92+
if ($this->logger === null) {
93+
$this->logger = \Magento\Framework\App\ObjectManager::getInstance()->create(LoggerInterface::class);
94+
}
95+
return $this->logger;
8596
}
8697

8798
/**
@@ -174,7 +185,7 @@ public function execute($entityType, $entityData, $arguments = [])
174185
if (isset($attributesMap[$attributeValue['attribute_id']])) {
175186
$entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
176187
} else {
177-
$this->logger->warning(
188+
$this->getLogger()->warning(
178189
"Attempt to load value of nonexistent EAV attribute '{$attributeValue['attribute_id']}'
179190
for entity type '$entityType'."
180191
);

0 commit comments

Comments
 (0)