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);
UPD2: (if you are using Symfony framework)
One more thing worth mentioning is PropelORM+Symfony.
If you need to trace SQL it is possible using logs. Propel has it's own monolog channel called propel
and fully qualified queries are logged with DEBUG
log level on relevant channel (propel.DEBUG
).
Log/query record looks like this:
[2016-10-04 17:00:46] propel.DEBUG: time: 0.000 sec | mem: 24.8 MB | connection: default | SELECT `id`, `username`, `email`, `last_login` FROM `users` WHERE `id` = 123 [] []
select
columns in the query above - Propel does that right before the find. Thus you must see something like:SELECT FROM book WHERE id=:p1; ... :p1=>25
– Ramp