如何显示Magento sql查询作为字符串? [英] How do you display a Magento sql query as a string?

查看:115
本文介绍了如何显示Magento sql查询作为字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Magento构造其SQL查询,例如

Magento constructs its SQL queries like

 $this->getSelect()->joinInner(
        array('sbao' => $this->getTable('sales/billing_agreement_order')),
        'main_table.entity_id = sbao.order_id',
        array()
    )

是否有一种方法以字符串格式显示结果查询而不是打印出巨大的对象eg

Is there a way to display the resulting query in a string format rather than printing out the huge object e.g.

echo $this->getSelect()->joinInner(
        array('sbao' => $this->getTable('sales/billing_agreement_order')),
        'main_table.entity_id = sbao.order_id',
        array()
    )->toString();


推荐答案

$select = $this->getSelect()->joinInner(
        array('sbao' => $this->getTable('sales/billing_agreement_order')),
        'main_table.entity_id = sbao.order_id',
        array()
    );

echo $select;

这篇关于如何显示Magento sql查询作为字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆