Skip to content

Commit 93f8eef

Browse files
Add compatibility with doctrine/orm 3
1 parent 9f3c43a commit 93f8eef

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"require-dev": {
4444
"doctrine/doctrine-bundle": "^2.1.1",
4545
"doctrine/mongodb-odm": "^2.2",
46-
"doctrine/orm": "^2.8",
46+
"doctrine/orm": "^2.8 || ^3.2",
4747
"doctrine/phpcr-odm": "^1.5.3 || ^2.0",
4848
"ergebnis/composer-normalize": "^2.28",
4949
"jackalope/jackalope-doctrine-dbal": "^1.2 || ^2.0",

src/Doctrine/RegisterListenersService.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ public function register(ObjectManager $manager, PagerInterface $pager, array $o
4949
});
5050
}
5151

52-
if (false === $options['debug_logging'] && $manager instanceof EntityManagerInterface) {
52+
if (
53+
false === $options['debug_logging']
54+
&& interface_exists('Doctrine\DBAL\Logging\SQLLogger')
55+
&& $manager instanceof EntityManagerInterface
56+
) {
5357
$configuration = $manager->getConnection()->getConfiguration();
5458
$logger = $configuration->getSQLLogger();
5559

tests/Unit/Doctrine/ORM/ElasticaToModelTransformerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace FOS\ElasticaBundle\Tests\Unit\Doctrine\ORM;
1313

1414
use Doctrine\ORM\AbstractQuery;
15+
use Doctrine\ORM\Query;
1516
use Doctrine\ORM\Query\Expr;
1617
use Doctrine\ORM\QueryBuilder;
1718
use Doctrine\Persistence\ManagerRegistry;
@@ -132,7 +133,7 @@ public function testTransformUsesDefaultQueryBuilderMethodConfiguration()
132133
*/
133134
public function testUsesHintsConfigurationIfGiven()
134135
{
135-
$query = $this->getMockBuilder(AbstractQuery::class)
136+
$query = $this->getMockBuilder(Query::class)
136137
->setMethods(['setHint', 'execute', 'setHydrationMode'])
137138
->disableOriginalConstructor()
138139
->getMockForAbstractClass()

tests/Unit/Doctrine/ORM/ListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected function getClassMetadataClass()
2525

2626
protected function getLifecycleEventArgsClass()
2727
{
28-
return \Doctrine\ORM\Event\LifecycleEventArgs::class;
28+
return \Doctrine\Persistence\Event\LifecycleEventArgs::class;
2929
}
3030

3131
protected function getListenerClass()

tests/Unit/Doctrine/RegisterListenersServiceTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ public function testShouldNotCallSleepListenerForAnotherPagers()
173173

174174
public function testShouldRegisterDisableDebugLoggingByDefaultForEntityManager()
175175
{
176+
if (!interface_exists('Doctrine\DBAL\Logging\SQLLogger')) {
177+
$this->markTestSkipped('This is only possible on doctrine/orm 2.');
178+
}
179+
176180
$dispatcher = $this->createDispatcherMock();
177181
$dispatcher->expects($this->exactly(2))
178182
->method('addListener')

0 commit comments

Comments
 (0)