13 use Psr\Log\LoggerInterface;
68 $metadata = $this->metadataPool->getMetadata(
$entityType);
69 $eavEntityType = $metadata->getEavEntityType();
70 return null === $eavEntityType ? [] : $this->config->getEntityAttributes($eavEntityType);
83 $metadata = $this->metadataPool->getMetadata(
$entityType);
84 $eavEntityType = $metadata->getEavEntityType();
85 return null === $eavEntityType ? [] : $this->config->getEntityAttributes($eavEntityType,
$entity);
113 $metadata = $this->metadataPool->getMetadata(
$entityType);
114 if (!$metadata->getEavEntityType()) {
117 $context = $this->scopeResolver->getEntityContext(
$entityType, $entityData);
120 $attributeTables = [];
131 if (count($attributeTables)) {
132 $attributeTables = array_keys($attributeTables);
133 foreach ($attributeTables as $attributeTable) {
136 [
't' => $attributeTable],
137 [
'value' =>
't.value',
'attribute_id' =>
't.attribute_id']
139 ->where($metadata->getLinkField() .
' = ?', $entityData[$metadata->getLinkField()]);
140 foreach ($context as $scope) {
143 $metadata->getEntityConnection()->quoteIdentifier($scope->getIdentifier()) .
' IN (?)',
145 )->order(
't.' . $scope->getIdentifier() .
' DESC');
149 $unionSelect = new \Magento\Framework\DB\Sql\UnionExpression(
153 foreach (
$connection->fetchAll($unionSelect) as $attributeValue) {
154 if (isset($attributesMap[$attributeValue[
'attribute_id']])) {
155 $entityData[$attributesMap[$attributeValue[
'attribute_id']]] = $attributeValue[
'value'];
157 $this->logger->warning(
158 "Attempt to load value of nonexistent EAV attribute '{$attributeValue['attribute_id']}' 159 for entity type '$entityType'."
execute($entityType, $entityData, $arguments=[])
getAttributes($entityType)
__construct(MetadataPool $metadataPool, ScopeResolver $scopeResolver, LoggerInterface $logger, \Magento\Eav\Model\Config $config)
getContextVariables(ScopeInterface $scope)