Wednesday, May 04, 2016

php - Propel: Get Raw SQL from Query object? - Stack Overflow

php - Propel: Get Raw SQL from Query object? - Stack Overflow



for different version:



$rawSql = new BookQuery::create()->filterById(25)->toString();
or
Fulfilling accepted answer, you can use next code afterwards query execution.
\Propel::getConnection()->getLastExecutedQuery() // Returns fully qualified SQL
It allows you to see the full query (including select columns and fetched parameters) which was sent to database.
UPD: (as mentioned by bbird)
This command won't output anything unless useDebug is true:
\Propel::getConnection()->useDebug(true);

No comments: