First of all, it is important to note that Propel uses PDO with prepared statements, so you won’t get a completely “embedded” SQL query in PHP. Using the criterion-> toString () is a good start, but, as Peter mentions, most of the work is actually done by the BasePeer :: createSelectSql () method.
Here is the most complete way (from Propel) to see how SQL (with placeholders) will look and the parameters that will be replaced:
$params = array(); // This will be filled with the parameters $sql = BasePeer::createSelectSql($criteria, $params); print "The raw SQL: " . $sql . "\n"; print "The parameters: " . print_r($params, true) . "\n";
Please note that you can only get the best mileage from registering queries at the database level. Of course, if PDO is configured (or supported) to use prepared native db statements, you can still see placeholders in db as well.
Hans l
source share