Skip to content

Commit d9a3833

Browse files
Merge pull request #390 from magento-jackalopes/MAGETWO-56063-upgrade-from-2.0.7-to-2.1.0
[Jackalopes] MAGETWO-56063 upgrade from 2.0.7 to 2.1.0 (2.2 release)
2 parents 2842e92 + d46494b commit d9a3833

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

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

+18-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\Model\Entity\ScopeInterface;
1414
use Magento\Framework\EntityManager\Operation\AttributeInterface;
1515
use Magento\Eav\Model\Entity\AttributeCache;
16+
use Psr\Log\LoggerInterface;
1617

1718
/**
1819
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -49,6 +50,11 @@ class ReadHandler implements AttributeInterface
4950
*/
5051
protected $scopeResolver;
5152

53+
/**
54+
* @var LoggerInterface
55+
*/
56+
private $logger;
57+
5258
/**
5359
* ReadHandler constructor.
5460
*
@@ -58,21 +64,24 @@ class ReadHandler implements AttributeInterface
5864
* @param AppResource $appResource
5965
* @param ScopeResolver $scopeResolver
6066
* @param AttributeCache $attributeCache
67+
* @param LoggerInterface $logger
6168
*/
6269
public function __construct(
6370
AttributeRepository $attributeRepository,
6471
MetadataPool $metadataPool,
6572
SearchCriteriaBuilder $searchCriteriaBuilder,
6673
AppResource $appResource,
6774
ScopeResolver $scopeResolver,
68-
AttributeCache $attributeCache
75+
AttributeCache $attributeCache,
76+
LoggerInterface $logger
6977
) {
7078
$this->attributeRepository = $attributeRepository;
7179
$this->metadataPool = $metadataPool;
7280
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
7381
$this->appResource = $appResource;
7482
$this->scopeResolver = $scopeResolver;
7583
$this->attributeCache = $attributeCache;
84+
$this->logger = $logger;
7685
}
7786

7887
/**
@@ -163,7 +172,14 @@ public function execute($entityType, $entityData, $arguments = [])
163172
\Magento\Framework\DB\Select::SQL_UNION_ALL
164173
);
165174
foreach ($connection->fetchAll($unionSelect) as $attributeValue) {
166-
$entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
175+
if (isset($attributesMap[$attributeValue['attribute_id']])) {
176+
$entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
177+
} else {
178+
$this->logger->warning(
179+
"Attempt to load value of nonexistent EAV attribute '{$attributeValue['attribute_id']}'
180+
for entity type '$entityType'."
181+
);
182+
}
167183
}
168184
}
169185
return $entityData;

0 commit comments

Comments
 (0)