TYPO3 - get resulting SQL from Extbase queryWhen you develop a TYPO3 Extbase extension, you may sometimes wonder, why a query does not return the exprected results. In this situation, it would be great if you can get the resultig SQL from TYPO3.
Actually, there are some solutions on the internet for this problem. Sadly, the one I found here does not work for me in TYPO3 6.0. The code snippet found here pointed me to the right direction. There is only one problem with the snippet, since it does not contain the whole SQL query (some parameters are filled with a questionmark).
So here is hopefully a complete solution on how to output the resulting SQL from an Extbase query.
Attention: The following code changes should only be done for development purposes on development systems.
- Open the file "/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php"
- Navigate to the function "GetObjectDataByQuery()"
- Go to the line next to "$this->replacePlaceholders($sql, $parameters, $tableName);"
- Insert the following code
This should output the resulting SQL query. Please notice, that this change can result in more than just one SQL query output, since now every query processed by Extbase is printed out.
If anyone has another solution for this problem, feel free to drop me a message.
Happy debugging :-)