1
0
mirror of synced 2025-01-20 23:41:39 +03:00

Add doccomments, refactor into listener and dump method to allow re-use

This commit is contained in:
Benjamin Eberlei 2011-07-08 14:32:12 +02:00
parent ef663c83f3
commit ac76dafe62

View File

@ -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();