24 private $metadataPool;
39 $this->metadataPool = $metadataPool;
52 if (!in_array(
$entityType, [ProductInterface::class, CategoryInterface::class],
true)) {
56 $metadata = $this->metadataPool->getMetadata(
$entityType);
58 $globalAttributes = [];
60 $eavEntityType = $metadata->getEavEntityType();
63 : $this->config->getEntityAttributes($eavEntityType,
new \
Magento\Framework\DataObject($entityData));
73 if ($globalAttributes) {
75 foreach ($globalAttributes as
$table => $attributeIds) {
79 [
'value' =>
't.value',
'attribute_id' =>
't.attribute_id']
81 ->where($metadata->getLinkField() .
' = ?', $entityData[$metadata->getLinkField()])
82 ->where(
'attribute_id' .
' in (?)', $attributeIds)
83 ->where(
'store_id = ?', \
Magento\Store\Model\Store::DEFAULT_STORE_ID);
86 $unionSelect = new \Magento\Framework\DB\Sql\UnionExpression(
88 \
Magento\Framework\DB\Select::SQL_UNION_ALL
90 foreach (
$connection->fetchAll($unionSelect) as $attributeValue) {
91 $entityData[$attributesMap[$attributeValue[
'attribute_id']]] = $attributeValue[
'value'];
__construct(MetadataPool $metadataPool, EavConfig $config)