From ac76dafe62b47f60b4ab5f4c1cbe4b9ae522feb5 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Fri, 8 Jul 2011 14:32:12 +0200 Subject: [PATCH] Add doccomments, refactor into listener and dump method to allow re-use --- .../ORM/Tools/DebugUnitOfWorkListener.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php b/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php index fa81d0aa4..5475d998f 100644 --- a/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php +++ b/lib/Doctrine/ORM/Tools/DebugUnitOfWorkListener.php @@ -33,6 +33,14 @@ class DebugUnitOfWorkListener private $file; private $context; + /** + * Pass a stream and contet information for the debugging session. + * + * The stream can be php://output to print to the screen. + * + * @param string $file + * @param string $context + */ public function __construct($file = 'php://output', $context = '') { $this->file = $file; @@ -41,8 +49,17 @@ class DebugUnitOfWorkListener public function onFlush(OnFlushEventArgs $args) { - $em = $args->getEntityManager(); + $this->dumpIdentityMap($args->getEntityManager()); + } + /** + * Dump the contents of the identity map into a stream. + * + * @param EntityManager $em + * @return void + */ + public function dumpIdentityMap(EntityManager $em) + { $uow = $em->getUnitOfWork(); $identityMap = $uow->getIdentityMap();