Last active
October 19, 2021 05:48
-
-
Save Ocramius/c1513eb0472be921613d to your computer and use it in GitHub Desktop.
SQL Logger in Doctrine 2 ORM and ZF2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Zend\ServiceManager\ServiceLocatorInterface; | |
return [ | |
'service_manager' => [ | |
'delegator' => [ | |
'doctrine.entitymanager.orm_default' => [ | |
function (ServiceLocatorInterface $sl, $name, $requestedName, $callback) { | |
/* @var $em \Doctrine\ORM\EntityManager */ | |
$em = $callback(); | |
$em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger()); | |
return $em; | |
}, | |
], | |
], | |
], | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had to change from delegator to delegators to work.