cancel
Showing results for 
Search instead for 
Did you mean: 

Why Magento2 set entity_type_id statically at CategorySetup, CustomerSetup

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Why Magento2 set entity_type_id statically at CategorySetup, CustomerSetup

I am trying to create a custom Eav entity in Magento 2.

I have gone through two core eav entity modules in Magento which are Catalog and Customer.

There are a couple of things which I found strange in these two modules.

 

Setup Files

CategorySetup.php :  

'entity_type_id' => self::CATEGORY_ENTITY_TYPE_ID

 

CustomerSetup.php :

entity_type_id' => \Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER

 

It seems like Magento sets entity_type_id statically here.

 

Q1: Why Magento sets staticallyentity_type_id here though it manages dynamically within the tableeav_entity_type?

w5dxP.png

 

Q2: When are the records in the eav_entity_type table created?

Q3: If I need to create a custom EAV model, the how should I define entity_type_id for that model