Skip to content

Commit 64cdba0

Browse files
committed
[DoctrineClearIdentityMapExtension] allow instances of ManagerRegistry
We only use the method `getManagers()` which comes from this interface, and not the RegistryInterface from Sf's doctrine bridge. So it makes sense to allow passing implementations of parent interfaces. This will also allow us to use this class with Doctrine ODM.
1 parent a73e48b commit 64cdba0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Diff for: pkg/enqueue-bundle/Consumption/Extension/DoctrineClearIdentityMapExtension.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
namespace Enqueue\Bundle\Consumption\Extension;
44

5+
use Doctrine\Common\Persistence\ManagerRegistry;
56
use Enqueue\Consumption\Context\MessageReceived;
67
use Enqueue\Consumption\MessageReceivedExtensionInterface;
7-
use Symfony\Bridge\Doctrine\RegistryInterface;
88

99
class DoctrineClearIdentityMapExtension implements MessageReceivedExtensionInterface
1010
{
1111
/**
12-
* @var RegistryInterface
12+
* @var ManagerRegistry
1313
*/
1414
protected $registry;
1515

1616
/**
17-
* @param RegistryInterface $registry
17+
* @param ManagerRegistry $registry
1818
*/
19-
public function __construct(RegistryInterface $registry)
19+
public function __construct(ManagerRegistry $registry)
2020
{
2121
$this->registry = $registry;
2222
}

Diff for: pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClearIdentityMapExtensionTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Enqueue\Bundle\Tests\Unit\Consumption\Extension;
44

5+
use Doctrine\Common\Persistence\ManagerRegistry;
56
use Doctrine\Common\Persistence\ObjectManager;
67
use Enqueue\Bundle\Consumption\Extension\DoctrineClearIdentityMapExtension;
78
use Enqueue\Consumption\Context\MessageReceived;
@@ -11,7 +12,6 @@
1112
use Interop\Queue\Processor;
1213
use PHPUnit\Framework\TestCase;
1314
use Psr\Log\LoggerInterface;
14-
use Symfony\Bridge\Doctrine\RegistryInterface;
1515

1616
class DoctrineClearIdentityMapExtensionTest extends TestCase
1717
{
@@ -59,11 +59,11 @@ protected function createContext(): MessageReceived
5959
}
6060

6161
/**
62-
* @return \PHPUnit_Framework_MockObject_MockObject|RegistryInterface
62+
* @return \PHPUnit_Framework_MockObject_MockObject|ManagerRegistry
6363
*/
64-
protected function createRegistryMock(): RegistryInterface
64+
protected function createRegistryMock(): ManagerRegistry
6565
{
66-
return $this->createMock(RegistryInterface::class);
66+
return $this->createMock(ManagerRegistry::class);
6767
}
6868

6969
/**

0 commit comments

Comments
 (0)