Logging SQL queries
Anyone know how to do this in 5.5?
I have this but it's wrong Code:
$entityManager = \XLite\Core\Database::getRepo('XC\ProductTags\Model\Tag')->getEntityManager(); |
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 |
All times are GMT -8. The time now is 02:03 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.