From 516d04c3911a5b18dca1d435506d5c3eb1ebd8a6 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Tue, 13 Jan 2015 00:31:32 +0100 Subject: [PATCH] #1001 DDC-3005 - Removing useless dependency from the `HydrationCompleteHandler` to the `UnitOfWork` --- .../ORM/Internal/HydrationCompleteHandler.php | 8 +------- lib/Doctrine/ORM/UnitOfWork.php | 2 +- .../ORM/Internal/HydrationCompleteHandlerTest.php | 12 +----------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/lib/Doctrine/ORM/Internal/HydrationCompleteHandler.php b/lib/Doctrine/ORM/Internal/HydrationCompleteHandler.php index 1f4c4c08c..4d6851f92 100644 --- a/lib/Doctrine/ORM/Internal/HydrationCompleteHandler.php +++ b/lib/Doctrine/ORM/Internal/HydrationCompleteHandler.php @@ -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; diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 0d126c84e..758754202 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -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); } /** diff --git a/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php b/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php index 60ad85116..14b930db2 100644 --- a/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php +++ b/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php @@ -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()