How does \Magento\Eav\Model\Entity\AttributeLoader::loadAllAttributes() work?

Context: How is \Magento\Framework\DataObject\AttributeLoaderInterface::loadAllAttributes() implemented?

Details: How does \Magento\Eav\Model\Config::getEntityAttributeCodes() work?

Details: How does \Magento\Eav\Model\Entity\AbstractEntity::getDefaultAttributes() work?



958164/app/code/Magento/Eav/Model/Entity/AttributeLoader.php#L80-L107

/**
 * Return default static virtual attribute that doesn't exists in EAV attributes
 *
 * @param \Magento\Eav\Model\Entity\AbstractEntity $resource
 * @param string $attributeCode
 * @return Attribute
 */
protected function _getDefaultAttribute(AbstractEntity $resource, $attributeCode)
{
	$entityTypeId = $resource->getEntityType()->getId();
	if (!isset($this->defaultAttributes[$entityTypeId][$attributeCode])) {
		$attribute = $this->objectManager->create(
			$resource->getEntityType()->getAttributeModel()
		)->setAttributeCode(
			$attributeCode
		)->setBackendType(
			AbstractAttribute::TYPE_STATIC
		)->setIsGlobal(
			1
		)->setEntityType(
			$resource->getEntityType()
		)->setEntityTypeId(
			$resource->getEntityType()->getId()
		);
		$this->defaultAttributes[$entityTypeId][$attributeCode] = $attribute;
	}
	return $this->defaultAttributes[$entityTypeId][$attributeCode];
}



Details: How does \Magento\Eav\Model\Entity\AbstractEntity::getAttribute() work?


See also: