Output zend-framework Zend_Db_Table select () generated request

I want to output a query generated by the select () Zend_Db_Table statement for testing, but I do not know how to do this.

+7
zend-framework zend-db-table
source share
2 answers

It is really very simple. The select object implements the toString method.

$select = $table->select()->.... echo $select; //prints SQL 

or

 $sql = $select->__toString(); 
+15
source share

or translate it into a string and then use:

 (string)$table->select(); 
+2
source share

All Articles