php-如何使用Magento的ORM在我的自定义表和magento的表之间建立内部联接?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php-如何使用Magento的ORM在我的自定义表和magento的表之间建立内部联接?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1634字,纯文字阅读大概需要3分钟。
内容图文
我需要在我的自定义表和Magento的实体表之一之间建立内部联接.如何使用Magento的ORM模型做到这一点?
非常感谢.
解决方法:
通读官方的API documentation,并查看joinTable,joinField和joinAttribute方法.
这是连接与Orders集合相关的表的示例:
$this->_orders = Mage::getResourceModel('sales/order_collection')
->addAttributeToSelect('*')
->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left')
->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left')
->joinAttribute('billing_street', 'order_address/street', 'billing_address_id', null, 'left')
->joinAttribute('billing_company', 'order_address/company', 'billing_address_id', null, 'left')
->joinAttribute('billing_city', 'order_address/city', 'billing_address_id', null, 'left')
->joinAttribute('billing_region', 'order_address/region', 'billing_address_id', null, 'left')
->joinAttribute('billing_country', 'order_address/country_id', 'billing_address_id', null, 'left')
->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
->joinAttribute('shipping_street', 'order_address/street', 'shipping_address_id', null, 'left')
->joinAttribute('shipping_company', 'order_address/company', 'shipping_address_id', null, 'left')
->joinAttribute('shipping_telephone', 'order_address/telephone', 'shipping_address_id', null, 'left')
->joinAttribute('shipping_fax', 'order_address/fax', 'shipping_address_id', null, 'left');
您还应该查看this question,以获取有关已尝试的方法及其效果的示例.
HTH,
京东
内容总结
以上是互联网集市为您收集整理的php-如何使用Magento的ORM在我的自定义表和magento的表之间建立内部联接?全部内容,希望文章能够帮你解决php-如何使用Magento的ORM在我的自定义表和magento的表之间建立内部联接?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。