function get_event($id){
$query = $this->em->createQuery('SELECT e.name,e.date, e.time, e.venue, e.venueaddress,e.parish,e.genre, e.entryprice, e.phone, e.specialguests,
e.weblink, e.otherinfo, e.flyer1, e.flyer2 from Events e WHERE e.id = :id');
$query->setParameter('id', $id);
//CAN I VIEW THE QUERY AT THIS TIME?
$result = $query->getResult();
return $result;
}
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
The
EchoSqlLogger
as suggested by Haim Evgi, well, echo´s the log output, so you should see it on your website.If you just want to see what SQL query Doctrine would generate, use:
But be aware, parameters are not included in that sql string, they are shown as placeholders (= ?).
The most common technique I use in order to watch what Doctrine does is enabling the mysql (or whatever db you use) query log (dont do this on a production server which is under heavy load!).
If the query log is under
/var/log/mysql/query.log
I just do this:(see tail command for more details)
And reload the page which executes the query.
In doctrine 2.3.2
now you can print $logger with print_r($logger);
SQL: SELECT tbl.id AS id0 FROM mytable tbl WHERE tbl.id = ?
Param: id | 1 | integer