How does \Magento\Eav\Model\ResourceModel\ReadHandler::execute() work?

Context: How does \Magento\Framework\EntityManager\Operation\Read\ReadAttributes::execute() work?

Details: How does \Magento\Framework\EntityManager\MetadataPool::getMetadata() work?

Details: How does \Magento\Framework\Model\Entity\ScopeResolver::getEntityContext() work?

Details: How does \Magento\Eav\Model\ResourceModel\ReadHandler::getAttributes() work?

(string)$unionSelect

(
	SELECT `t`.`value`, `t`.`attribute_id` 
		FROM `catalog_product_entity_varchar` AS `t` 
		WHERE (entity_id = '128') AND (`store_id` IN (0)) 
		ORDER BY `t`.`store_id` DESC
)
UNION ALL(
	SELECT `t`.`value`, `t`.`attribute_id` 
		FROM `catalog_product_entity_text` AS `t` 
		WHERE (entity_id = '128') AND (`store_id` IN (0)) 
		ORDER BY `t`.`store_id` DESC
)
UNION ALL(
	SELECT `t`.`value`, `t`.`attribute_id` 
		FROM `catalog_product_entity_decimal` AS `t` 
		WHERE (entity_id = '128') AND (`store_id` IN (0)) 
		ORDER BY `t`.`store_id` DESC
)
UNION ALL(
	SELECT `t`.`value`, `t`.`attribute_id` 
		FROM `catalog_product_entity_datetime` AS `t` 
		WHERE (entity_id = '128') AND (`store_id` IN (0)) 
		ORDER BY `t`.`store_id` DESC
)
UNION ALL(
	SELECT `t`.`value`, `t`.`attribute_id` 
		FROM `catalog_product_entity_int` AS `t` 
		WHERE (entity_id = '128') AND (`store_id` IN (0)) 
		ORDER BY `t`.`store_id` DESC
)

See also: