How do you display a Magento sql query as a string?
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()
)
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()
)->开发者_JAVA技巧;toString();
$select = $this->getSelect()->joinInner(
array('sbao' => $this->getTable('sales/billing_agreement_order')),
'main_table.entity_id = sbao.order_id',
array()
);
echo $select;
I nearly had it for those interested you need to use ->__toString() e.g.
echo $this->getSelect()->joinInner(
array('sbao' => $this->getTable('sales/billing_agreement_order')),
'main_table.entity_id = sbao.order_id',
array()
)->__toString()
精彩评论