Re: Logging SQL queries
Are you trying to see what the actual sql query is or trying to fetch all records of a model? It's not clear.
Database::getEm() will give you the entity manager.
Database::getEm()->getConnection() will give you the connection
..... chain the rest as needed
or
Database::getRepo(Tag::class)->createQueryBuilder('t')->select('t')->getQuery()->getSQL();
You can dump it using dd() or dump() passing the above result as an argument or you can use the XC logging to log the query from that result. If the query has params you can get them by replacing getQSL with getParameters
__________________
Steve Stoyanov
CFLSystems.com
Web Development
|