- Sending the statement, for it to be prepared (this is what is returned by $query->getSql();)
- And, then, sending the parameters (returned by $query->getParameters();)
- and executing the prepared statements
Show SQL: $sql=$query->getSQL(); Show Parameters: $parameters=$query->getParameters();In this way, you can generate or print the real sql using Doctrine and Symfony. In my opinion, It will be much easy to debug the errors in the real sql than doctrine prepared query.
Source : http://stackoverflow.com/a/2095467