Skip to content

Instantly share code, notes, and snippets.

@silvioq
Created February 10, 2017 12:35
Show Gist options
  • Save silvioq/58f412e7b61dc8776012081a94074a04 to your computer and use it in GitHub Desktop.
Save silvioq/58f412e7b61dc8776012081a94074a04 to your computer and use it in GitHub Desktop.
Symfony, uso un log nulo para evitar uso de memoria
/**
* Uso un logger de Doctrine nulo, para evitar problemas de uso de memoria
* @see http://stackoverflow.com/questions/9699185/memory-leaks-symfony2-doctrine2-exceed-memory-limit
* @var Psr\Log\LoggerInterface
*/
$oldLogger = $this->em->getConnection()->getConfiguration()->getSQLLogger();
$this->em->getConnection()->getConfiguration()->setSQLLogger(null);
// ....
$this->em->getConnection()->getConfiguration()->setSQLLogger($oldLogger);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment