Magento查询__toString()就像Zend一样

Mat*_*ijo 2 magento

我可以像绳子一样归还吗?类似的Zend框架 - > __ toString()

在这里我选择我的类别(只是名称)活跃时......

$categories = Mage::getModel('catalog/category')
        ->getCollection()
        ->addAttributeToSelect('name')
        ->addFieldToFilter('is_active', 1);
Run Code Online (Sandbox Code Playgroud)

我希望看到像字符串sql查询"SELECT*..."

Jos*_*ter 5

(string)$categories->getSelect();

您必须使用该getSelect()函数并将其结果转换为字符串.它将利用上述__toString()函数并返回查​​询结果.