Magento快速获取ResourceModel问题
这行代码调用了什么类(如果有)?
Mage::getResourceModel('sales/order_invoice_collection')
本质上,我试图找出使用此资源模型访问哪些数据库表以及如何调整它。谢谢!
What class (if any) is called with this line of code?
Mage::getResourceModel('sales/order_invoice_collection')
Essentially I"m trying to figure out what database table is accessed with this resource model and how I can tweak that. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您正在寻找的类是这样的:
位于
app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Collection.php
。如果您查看销售模块
app/code/core/Mage/Sales/etc/config.xml
的配置,您可以在资源模型的定义中看到表名称:要了解有关 Magento 如何与数据库交互的更多信息,您应该阅读有关模型、资源模型和集合的内容:
http://www .magentocommerce.com/knowledge-base/entry/magento-for-dev-part-5-magento-models-and-orm-basics
The class you are looking for is this:
located in
app/code/core/Mage/Sales/Model/Mysql4/Order/Invoice/Collection.php
.If you take a look at the configuration for the sales module
app/code/core/Mage/Sales/etc/config.xml
, you can see the table name in the definition of the resource models:To learn more about how Magento interacts with the database, you should read about models, resource models, and collections:
http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-5-magento-models-and-orm-basics
试试这个来获取由语句产生的类:
Try this to get the class resulting from a statement:
在本例中,它正在加载
类名:
这可以通过查看 config.xml 来确定:
在 models 标签下是 sales 标签,您可以从字符串中斜杠之前的“sales”得知。在那里,它将资源模型定义为 sales_mysql4。
因此,如果您调用:
加载的文件将是:
希望有帮助。
In this instance it is loading
which is class name:
This can be determined by looking at the config.xml:
In it under the models tag is the sales tag, which you know from 'sales' before the slash in the string. There it defines the resource model as sales_mysql4.
So, if you call:
the file loaded will be:
Hope that helps.