mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-94: Queries executed through StandardEntityPersister load(), loadAll(), etc. are not logged. #115
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Nov 1, 2009).
Jira issue originally created by user simonvdd:
In Doctrine\DBAL\Connection, execute() and executeUpdate() methods both call:
$this->_config->getSqlLogger()->logSql($query, $params)
But when you use the Doctrine\ORM\Persisters\StandardEntityPersister (which is the case with all magic repository methods in Symfony, such as Models\User::findAll() for example), it only calls the prepare() method of the Connection, so the query is not logged (and does not appear in the Debug Panel in Symfony for instance).
I added the following line in Doctrine\DBAL\Connection.php, in method prepare():
if ($this->_config->getSqlLogger()) {
$this->_config->getSqlLogger()->logSql($statement);
}
which seem to solve the problem in this case.
@doctrinebot commented on GitHub (Nov 1, 2009):
@doctrinebot commented on GitHub (Nov 2, 2009):
Comment created by @beberlei:
This is an obvious fix, but it leads to the problem that the $params are not logged.
I ask myself if the SqlLogger shouldn't be passed to the Connection Driver also to solve this problem.
@doctrinebot commented on GitHub (Nov 20, 2009):
Comment created by romanb:
Not only would the params not be logged but in the case of a prepared statement that is executed several times you would miss queries.
So this needs to be logged on the caller side where the statement is prepared and executed (one or more times).
@doctrinebot commented on GitHub (Dec 2, 2009):
Issue was closed with resolution "Fixed"