Skip to content

Commit

Permalink
Merge pull request #390 from magento-jackalopes/MAGETWO-56063-upgrade…
Browse files Browse the repository at this point in the history
…-from-2.0.7-to-2.1.0

[Jackalopes] MAGETWO-56063 upgrade from 2.0.7 to 2.1.0 (2.2 release)
  • Loading branch information
heyitsroberthe authored Sep 19, 2016
2 parents 2842e92 + d46494b commit d9a3833
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Magento\Framework\Model\Entity\ScopeInterface;
use Magento\Framework\EntityManager\Operation\AttributeInterface;
use Magento\Eav\Model\Entity\AttributeCache;
use Psr\Log\LoggerInterface;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
Expand Down Expand Up @@ -49,6 +50,11 @@ class ReadHandler implements AttributeInterface
*/
protected $scopeResolver;

/**
* @var LoggerInterface
*/
private $logger;

/**
* ReadHandler constructor.
*
Expand All @@ -58,21 +64,24 @@ class ReadHandler implements AttributeInterface
* @param AppResource $appResource
* @param ScopeResolver $scopeResolver
* @param AttributeCache $attributeCache
* @param LoggerInterface $logger
*/
public function __construct(
AttributeRepository $attributeRepository,
MetadataPool $metadataPool,
SearchCriteriaBuilder $searchCriteriaBuilder,
AppResource $appResource,
ScopeResolver $scopeResolver,
AttributeCache $attributeCache
AttributeCache $attributeCache,
LoggerInterface $logger
) {
$this->attributeRepository = $attributeRepository;
$this->metadataPool = $metadataPool;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->appResource = $appResource;
$this->scopeResolver = $scopeResolver;
$this->attributeCache = $attributeCache;
$this->logger = $logger;
}

/**
Expand Down Expand Up @@ -163,7 +172,14 @@ public function execute($entityType, $entityData, $arguments = [])
\Magento\Framework\DB\Select::SQL_UNION_ALL
);
foreach ($connection->fetchAll($unionSelect) as $attributeValue) {
$entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
if (isset($attributesMap[$attributeValue['attribute_id']])) {
$entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
} else {
$this->logger->warning(
"Attempt to load value of nonexistent EAV attribute '{$attributeValue['attribute_id']}'
for entity type '$entityType'."
);
}
}
}
return $entityData;
Expand Down

0 comments on commit d9a3833

Please sign in to comment.