Pregunta

I have the next doubt:

In the EAV data structure you can find an attribute in the entity or in the table of the associated type.

For Example:

catalog_product_entity

| entity_id | entity_type_id | attribute_set_id | type_id |   sku   | has_option | ....
|     1     |        4       |       34         |  simple | 0912132 |    0       |

catalog_product_entity_datetatime

| value_id  |  entity_type_id | attribute_id  | store_id | entity_id | value
|    1      |       4         |      71       |    0     |     1     |  NULL

catalog_product_entity_decimal

 | value_id  |  entity_type_id | attribute_id  | store_id | entity_id |value 
 |    1      |       4         |     69        |   1      |    1      | 29.009

you can find the attribute sku in the flat table catalog_product_entity, and the attribute_id 71 and 69 in the tables catalog_product_entity_datatime and catalog_product_entity_decimal

Why is the attribute sku in the entity table? is it because of optimization reasons?

If I want to improve the load of an attribute, could I insert it in the entity table? What is a reasonable number of attributes in the entity table?

¿Fue útil?

Solución

These attributes (with type static) are necessary in order to do a proper save of any EAV object without overwriting the save() method or other methods involved in the save for each entity type.
You can take a look at this method Mage_Eav_Model_Entity_Abstract::_collectSaveData(). All EAV entity models extend Mage_Eav_Model_Entity_Abstract and that method is called when saving an instance.
All the static attribtues are added to the array $entityRow. this means that they will be saved in the main table but you still have the option to attach a backend_model to the static attribute that will process the value to be saved, before the actual save is done.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top