【问题标题】:Magento - What are the diferences between an EAV attribute in the entity and attribute in its table typeMagento - 实体中的 EAV 属性与其表类型中的属性之间有什么区别
【发布时间】:2014-01-23 09:33:27
【问题描述】:

我还有下一个疑问:

在 EAV 数据结构中,您可以在实体或关联类型的表中找到属性。

例如:

目录产品实体

| 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

您可以在平面表catalog_product_entity中找到属性sku,在表catalog_product_entity_datatime中找到属性_id 7169 catalog_product_entity_decimal

为什么实体表中有属性sku?是因为优化的原因吗?

如果我想提高一个属性的负载,我可以将它插入到实体表中吗?实体表中属性的合理数量是多少?

【问题讨论】:

    标签: database magento optimization entity-attribute-value


    【解决方案1】:

    为了正确保存任何 EAV 对象而不覆盖 save() 方法或每个实体类型保存中涉及的其他方法,这些属性(具有静态类型)是必需的。
    你可以看看这个方法Mage_Eav_Model_Entity_Abstract::_collectSaveData()。所有 EAV 实体模型都扩展 Mage_Eav_Model_Entity_Abstract 并在保存实例时调用该方法。
    所有静态属性都添加到数组$entityRow。这意味着它们将保存在主表中,但您仍然可以选择在实际保存完成之前将backend_model 附加到将处理要保存的值的静态属性。

    【讨论】:

    • 您好 Marius,感谢您的回答。 Magento 在哪里可以深入搜索 eav 信息?你能告诉我一些额外的信息吗?
    • @davidselo。从这个开始:magentocommerce.com/knowledge-base/entry/…。其余的你可以通过自己动手编写代码来发现。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-12
    • 2015-03-12
    • 2021-12-26
    • 2011-07-19
    • 2016-04-29
    相关资源
    最近更新 更多