Magento: exibindo SQL de collection

Em qualquer classe que estenda de Mage_Core_Model_Mysql4_Collection_Abstract e/ou Varien_Data_Collection_Db é possível visualizar a SQL montada para recuperar essa coleção de registros. Basta fazer um cast para string:

var_dump((string)$collection->getSelect());

Ou sem cast:

var_dump($collection->getSelect()->assemble());

Posts relacionados:

  1. Sobrescrevendo controllers do admin no Magento

This entry was posted in Artigos and tagged , , . Bookmark the permalink.

One Response to Magento: exibindo SQL de collection

  1. Pingback: Magento: exibindo SQL de collection « Filipe Ibaldo Gomes

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">