Doctrine - how to get the SQL INSERT query, in the postSave() event?

后端 未结 5 944
一向
一向 2021-02-09 05:57

I would like to get the exact SQL INSERT query that Doctrine generates when an object\'s save() method is called.

Preferably, I would like to get it in the postSave() ev

5条回答
  •  南旧
    南旧 (楼主)
    2021-02-09 06:36

    Why don't you try to see how the symfony developers do it? Check their WebDebug Toolbar for Doctrine here. The WebDebug Toolbar outputs all query that you do on a page.

    There's a hook on DoctrineEvent, and I think you can modify the code to do what you want. Check the getDoctrineEvents and getSqlLogs method.

    Hope this helps. If you need further explanation, please write it in comment, I'll try my best to explain.

提交回复
热议问题