1
0
mirror of synced 2025-01-31 12:32:59 +03:00

#1001 DDC-3005 - Removing useless dependency from the HydrationCompleteHandler to the UnitOfWork

This commit is contained in:
Marco Pivetta 2015-01-13 00:31:32 +01:00
parent fccd08afa5
commit 516d04c391
3 changed files with 3 additions and 19 deletions

View File

@ -20,12 +20,10 @@
namespace Doctrine\ORM\Internal;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\ListenersInvoker;
use Doctrine\ORM\Events;
use Doctrine\ORM\UnitOfWork;
/**
* Class, which can handle completion of hydration cycle and produce some of tasks.
@ -38,9 +36,6 @@ use Doctrine\ORM\UnitOfWork;
*/
final class HydrationCompleteHandler
{
/** @var \Doctrine\ORM\UnitOfWork */
private $uow;
/** @var \Doctrine\ORM\Event\ListenersInvoker */
private $listenersInvoker;
@ -53,11 +48,10 @@ final class HydrationCompleteHandler
/**
* Constructor for this object
*
* @param UnitOfWork $uow
* @param \Doctrine\ORM\Event\ListenersInvoker $listenersInvoker
* @param \Doctrine\ORM\EntityManagerInterface $em
*/
public function __construct(UnitOfWork $uow, ListenersInvoker $listenersInvoker, EntityManagerInterface $em)
public function __construct(ListenersInvoker $listenersInvoker, EntityManagerInterface $em)
{
$this->uow = $uow;
$this->listenersInvoker = $listenersInvoker;

View File

@ -296,7 +296,7 @@ class UnitOfWork implements PropertyChangedListener
$this->listenersInvoker = new ListenersInvoker($em);
$this->hasCache = $em->getConfiguration()->isSecondLevelCacheEnabled();
$this->identifierFlattener = new IdentifierFlattener($this, $em->getMetadataFactory());
$this->hydrationCompleteHandler = new HydrationCompleteHandler($this, $this->listenersInvoker, $em);
$this->hydrationCompleteHandler = new HydrationCompleteHandler($this->listenersInvoker, $em);
}
/**

View File

@ -33,11 +33,6 @@ use stdClass;
*/
class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase
{
/**
* @var \Doctrine\ORM\UnitOfWork|\PHPUnit_Framework_MockObject_MockObject
*/
private $unitOfWork;
/**
* @var \Doctrine\ORM\Event\ListenersInvoker|\PHPUnit_Framework_MockObject_MockObject
*/
@ -58,14 +53,9 @@ class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase
*/
protected function setUp()
{
$this->unitOfWork = $this->getMock('Doctrine\ORM\UnitOfWork', array(), array(), '', false);
$this->listenersInvoker = $this->getMock('Doctrine\ORM\Event\ListenersInvoker', array(), array(), '', false);
$this->entityManager = $this->getMock('Doctrine\ORM\EntityManagerInterface');
$this->handler = new HydrationCompleteHandler(
$this->unitOfWork,
$this->listenersInvoker,
$this->entityManager
);
$this->handler = new HydrationCompleteHandler($this->listenersInvoker, $this->entityManager);
}
public function testDefersPostLoadOfEntity()