سؤال

Inside file app/code/core/Mage/Sales/etc/config.xml, there is:

<sales>
    <class>Mage_Sales_Model</class>
    <resourceModel>sales_resource</resourceModel>
</sales>
<sales_entity>
    <class>Mage_Sales_Model_Entity</class>
    <entities>
        <quote>
            <table>sales_quote</table>
        </quote>
        ...
    </entities>
</sales_entity>
<sales_resource>
    <class>Mage_Sales_Model_Resource</class>
    <entities>
        <quote>
            <table>sales_quote</table>
        </quote>
        ...
    </entities>
</sales_resource>

What do these <entities> tags represent exactly? How to interpret them? I see they contain all the table names, but how does the tables declared under <sales> relate to the ones under <sales_resource>? Why does <sales> have a <resourceModel> element and <sales_entity> does not?

I would like to query shipping data related to orders, possibly joined with some other product and customer data. I am trying to figure out how to get the proper resource model object for sales_flat_shipment, then join it with sales_flat_order_item for example.

هل كانت مفيدة؟

المحلول

These nodes are for backwards compatibility.

In the past, orders were EAV too, but this changed in 1.4 (I think).

Since this version I would assume, they added the <sales_resource> node, because since then, we have a standard resource model (no EAV anymore). Before this, magento had sales_entity as representaion of the eav_entity.

Therefore if don't have modules which depend on this, you might delete the <sales_entity> node.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top