how eav load


namespace VendorName\TestModule\Model\ResourceModel;

class CustomEav extends \Magento\Eav\Model\Entity\AbstractEntity
    public function getEntityType() {
        if(empty($this->_type)) {
        return parent::getEntityType();

    $res = $this->_objectManager->get('VendorName\TestModule\Model\ResourceModel\CustomEav');
    $product = $this->_objectManager->get('Magento\Catalog\Model\Product');
    $res->load($product, 1);


Now we get the proudct’s eav attributes.


Source: Magento\Eav\Model\Entity\AbstractEntity
See _loadModelAttributes() in the above fle for details about the loading
process. Magento creates a UNION select to load attributes from each of the entity
type tables to locate the applicable attribute values.
See _collectSaveData() in the above fle for how the saving process works.
EAV collections offer other methods such as addAttributeToSelect (note
that the feld methods, such as addFieldToFilter have been mapped to their
attribute counterparts).

Simple resource model extens Magento\Framework\Model\ResourceModel\Db\AbstractDb


Magento 2: Creating New Eav Entity and Model (Updated for Data Installation)


电子邮件地址不会被公开。 必填项已用*标注